Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
baa5aa4c74 | ||
![]() |
c9ca4d965a | ||
![]() |
509e01e501 | ||
![]() |
118d08219e | ||
![]() |
45db9f89e2 | ||
![]() |
de8d181dde | ||
![]() |
cfe1e2927c | ||
![]() |
03a4e64337 | ||
![]() |
00fd3908d8 | ||
![]() |
641e3a6945 | ||
![]() |
c4491f89e0 | ||
![]() |
f5940ef807 | ||
![]() |
b1adcc892a |
BIN
Ergebnisse/AllesHardware.PNG
Normal file
BIN
Ergebnisse/AllesHardware.PNG
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
BIN
Ergebnisse/AllesSoftware.PNG
Normal file
BIN
Ergebnisse/AllesSoftware.PNG
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
@ -13,8 +13,8 @@ entity add is
|
||||
|
||||
task_start : in std_logic;
|
||||
task_state : out work.task.State;
|
||||
|
||||
signal_a_read : out std_logic;
|
||||
|
||||
signal_a_read : out std_logic; --signal_read wird als Bestätigung gesetzt, dass die Daten gelesen wurden, d.h. bei der nächsten rising edge werden die nächsten Daten angelegt.
|
||||
signal_a_readdata : in std_logic_vector( 31 downto 0 );
|
||||
|
||||
signal_b_read : out std_logic;
|
||||
@ -30,7 +30,39 @@ architecture rtl of add is
|
||||
signal next_task_state : work.task.State;
|
||||
signal index : integer range 0 to work.task.STREAM_LEN;
|
||||
|
||||
--hier noch einige Signale anlegen
|
||||
signal done_flag : std_logic;
|
||||
signal start_flag : std_logic;
|
||||
|
||||
--Zustände für die Zustandsmaschine für die Berechnung
|
||||
type CalcState is (
|
||||
CALC_IDLE,
|
||||
CALC_ADD,
|
||||
CALC_STORE_RESULT
|
||||
);
|
||||
|
||||
--Signale für die Zustandsmaschine für die Berechnung
|
||||
signal current_calc_state : CalcState;
|
||||
signal next_calc_state : CalcState;
|
||||
|
||||
signal ergebnis : signed( 31 downto 0); --das hier vielleicht zu std_logic_vector oder float
|
||||
signal ergebnis_valid : std_logic;
|
||||
|
||||
begin
|
||||
|
||||
u_float_add : entity work.float_add --Das hier ist der IP Core !!!
|
||||
port map(
|
||||
clk => clk,
|
||||
reset => reset,
|
||||
start => start_flag,
|
||||
done => done_flag,
|
||||
A => signal_a_readdata,
|
||||
B => signal_b_readdata,
|
||||
sum => signal_writedata
|
||||
);
|
||||
|
||||
--task_state_transitions wird nicht geaendert
|
||||
--Übergangsschaltnetz der Zustandsmaschine zu Steuerung der Tasks
|
||||
task_state_transitions : process ( current_task_state, task_start, index ) is
|
||||
begin
|
||||
next_task_state <= current_task_state;
|
||||
@ -40,7 +72,7 @@ begin
|
||||
next_task_state <= work.task.TASK_RUNNING;
|
||||
end if;
|
||||
when work.task.TASK_RUNNING =>
|
||||
if ( index = work.task.STREAM_LEN - 1 ) then
|
||||
if ( index = work.task.STREAM_LEN ) then
|
||||
next_task_state <= work.task.TASK_DONE;
|
||||
end if;
|
||||
when work.task.TASK_DONE =>
|
||||
@ -50,28 +82,76 @@ begin
|
||||
end case;
|
||||
end process task_state_transitions;
|
||||
|
||||
sync : process ( clk, reset ) is
|
||||
begin
|
||||
if ( reset = '1' ) then
|
||||
current_task_state <= work.task.TASK_IDLE;
|
||||
index <= 0;
|
||||
elsif ( rising_edge( clk ) ) then
|
||||
current_task_state <= next_task_state;
|
||||
case next_task_state is
|
||||
when work.task.TASK_IDLE =>
|
||||
index <= 0;
|
||||
signal_write <= '0';
|
||||
when work.task.TASK_RUNNING =>
|
||||
index <= index + 1;
|
||||
signal_write <= '1';
|
||||
signal_writedata <= ( others => '0' );
|
||||
when work.task.TASK_DONE =>
|
||||
index <= 0;
|
||||
signal_write <= '0';
|
||||
end case;
|
||||
end if;
|
||||
end process sync;
|
||||
|
||||
--Übergangsschaltnetz der Zustandsmaschine für die Berechnung ###Fertig
|
||||
calc_state_transitions: process (all) is
|
||||
begin
|
||||
next_calc_state <= current_calc_state;
|
||||
case current_calc_state is
|
||||
when CALC_IDLE=>
|
||||
if (current_task_state= work.task.TASK_RUNNING) then
|
||||
next_calc_state <= CALC_ADD;
|
||||
end if;
|
||||
when CALC_ADD =>
|
||||
if (done_flag = '1') then
|
||||
next_calc_state <= CALC_STORE_RESULT;
|
||||
end if;
|
||||
when CALC_STORE_RESULT =>
|
||||
next_calc_state <= CALC_IDLE;
|
||||
end case;
|
||||
end process calc_state_transitions;
|
||||
|
||||
task_state <= current_task_state;
|
||||
|
||||
--Zustandsspeicher und Ausgangsschaltnetz zu der Steuerung der Tasks
|
||||
task_sync : process (clk, reset) is
|
||||
begin
|
||||
if (reset = '1') then
|
||||
current_task_state <= work.task.TASK_IDLE;
|
||||
|
||||
elsif (rising_edge( clk)) then
|
||||
current_task_state <= next_task_state;
|
||||
case next_task_state is
|
||||
when work.task. TASK_IDLE => null;
|
||||
when work.task. TASK_RUNNING => null;
|
||||
when work.task. TASK_DONE => null;
|
||||
end case;
|
||||
end if;
|
||||
end process task_sync;
|
||||
|
||||
--Zustandsspeicher und Ausgangsschaltnetz zu Berechnung
|
||||
sync : process (clk, reset) is
|
||||
begin
|
||||
if (reset = '1') then
|
||||
index <= 0;
|
||||
current_calc_state <= CALC_IDLE;
|
||||
ergebnis <= (others => '0');
|
||||
ergebnis_valid <= '0';
|
||||
signal_write <= '0';
|
||||
--signal_writedata <= (others => '0');
|
||||
signal_a_read <= '0';
|
||||
signal_b_read <= '0';
|
||||
elsif (rising_edge( clk)) then
|
||||
current_calc_state <= next_calc_state;
|
||||
ergebnis_valid <= '0';
|
||||
case next_calc_state is
|
||||
when CALC_IDLE =>
|
||||
start_flag <= '0';
|
||||
signal_a_read <= '0'; --Daten wurden noch nicht verwendet.
|
||||
signal_b_read <= '0';
|
||||
signal_write <= '0';
|
||||
when CALC_ADD => --hier Berechnung mit IP Core?
|
||||
start_flag <= '1';
|
||||
when CALC_STORE_RESULT =>
|
||||
start_flag <= '0';
|
||||
index <= index + 1;
|
||||
signal_write <= '1';
|
||||
--signal_writedata <= std_logic_vector( ergebnis ); --Ergebnis schreiben, ergebnis direkt aus IP Core anschliessen
|
||||
--mitteilen, dass die Daten gelesen wurden und jetzt neue Daten angelegt werden sollen
|
||||
signal_a_read <= '1';
|
||||
signal_b_read <= '1';
|
||||
end case;
|
||||
end if;
|
||||
end process sync;
|
||||
task_state <= current_task_state;
|
||||
|
||||
end architecture rtl;
|
||||
|
@ -28,7 +28,38 @@ architecture rtl of crc is
|
||||
signal next_task_state : work.task.State;
|
||||
signal index : integer range 0 to work.task.STREAM_LEN;
|
||||
|
||||
-- function berechne_crc(crc_in : signed( 31 downto 0 ), data : signed( 31 downto 0 )) return signed;
|
||||
|
||||
--Selbst angelegte Signale
|
||||
signal data_valid_flag : std_logic;
|
||||
signal busy_flag : std_logic;
|
||||
signal result_valid_flag : std_logic;
|
||||
|
||||
signal flag_index : bit := '0';
|
||||
signal crc_state : integer range 0 to 2;
|
||||
|
||||
signal crcOut : std_logic_vector( 31 downto 0);
|
||||
signal crcIn : std_logic_vector( 31 downto 0) := x"FFFFFFFF";
|
||||
|
||||
--Zustände für die Zustandsmaschine für die Berechnung
|
||||
type CalcState is (
|
||||
CALC_IDLE,
|
||||
CALC_START,
|
||||
CALC_CRC,
|
||||
CALC_STORE_RESULT
|
||||
);
|
||||
--Signale für die Zustandsmaschine für die Berechnung
|
||||
signal current_calc_state : CalcState;
|
||||
signal next_calc_state : CalcState;
|
||||
|
||||
|
||||
|
||||
-- Anmerkung zu CRC-Polynom:
|
||||
-- in Software wurde 0xEDB88320 CRC-32 Polynom (Invers) verwendet
|
||||
-- nicht invers waere 0x04C11DB7
|
||||
begin
|
||||
|
||||
-- Diesen Prozess nicht aendern
|
||||
task_state_transitions : process ( current_task_state, task_start, index ) is
|
||||
begin
|
||||
next_task_state <= current_task_state;
|
||||
@ -48,6 +79,31 @@ begin
|
||||
end case;
|
||||
end process task_state_transitions;
|
||||
|
||||
--Übergangsschaltnetz der Zustandsmaschine für die Berechnung ###Nur aus sine.vhd kopiert!
|
||||
calc_state_transitions: process (all) is
|
||||
begin
|
||||
next_calc_state <= current_calc_state;
|
||||
case current_calc_state is
|
||||
when CALC_IDLE=>
|
||||
if (current_task_state= work.task.TASK_RUNNING) then
|
||||
next_calc_state <= CALC_START;
|
||||
end if;
|
||||
when CALC_START=>
|
||||
next_calc_state <= CALC_CRC;
|
||||
when CALC_CRC =>
|
||||
if (result_valid_flag = '1' and busy_flag = '0') then --or falling_edge( busy) ?
|
||||
next_calc_state <= CALC_STORE_RESULT;
|
||||
end if;
|
||||
when CALC_STORE_RESULT =>
|
||||
if ( index = work.task.STREAM_LEN ) then
|
||||
next_calc_state <= CALC_IDLE;
|
||||
else
|
||||
next_calc_state <= CALC_START;
|
||||
end if;
|
||||
end case;
|
||||
end process calc_state_transitions;
|
||||
|
||||
--Dieser Prozess war vorher schon drin, muss aber noch modifiziert werden
|
||||
sync : process ( clk, reset ) is
|
||||
begin
|
||||
if ( reset = '1' ) then
|
||||
@ -58,18 +114,91 @@ begin
|
||||
case next_task_state is
|
||||
when work.task.TASK_IDLE =>
|
||||
index <= 0;
|
||||
signal_write <= '0';
|
||||
-- signal_write <= '0';
|
||||
when work.task.TASK_RUNNING =>
|
||||
index <= index + 1;
|
||||
signal_write <= '1';
|
||||
signal_writedata <= ( others => '0' );
|
||||
if ( flag_index = '1' ) then
|
||||
index <= index + 1;
|
||||
end if;
|
||||
--signal_write <= '1';
|
||||
--signal_writedata <= ( others => '0' );
|
||||
when work.task.TASK_DONE =>
|
||||
index <= 0;
|
||||
signal_write <= '0';
|
||||
--signal_write <= '0';
|
||||
end case;
|
||||
end if;
|
||||
end process sync;
|
||||
|
||||
crc_calc :process ( clk, reset ) is
|
||||
begin
|
||||
if ( reset = '1' ) then
|
||||
signal_read <= '0';
|
||||
signal_write <= '0';
|
||||
signal_writedata <= (others => '0');
|
||||
flag_index <= '0';
|
||||
elsif ( rising_edge( clk ) ) then
|
||||
case crc_state is --current oder next_calc_state
|
||||
when 0 =>
|
||||
signal_write <= '0';
|
||||
flag_index <= '0';
|
||||
if ( current_task_state = work.task.TASK_RUNNING ) then
|
||||
signal_read <= '1';
|
||||
crc_state <= 1; --Calc Zustand aendern. Sollte ueber Uebergangsschaltnetz geregelt werden
|
||||
end if;
|
||||
when 1 =>
|
||||
signal_read <= '0';
|
||||
--Berechne hier crc_out
|
||||
--Die Berechnung muss für jedes Byte wieder durchgeführt werden
|
||||
--Einfacher als Berechnung mit IP Core waere genau hier den ganzen Code davon reinkopieren
|
||||
crcOut(0) <= crcIn(0) xor crcIn(1) xor crcIn(2) xor crcIn(3) xor crcIn(4) xor crcIn(6) xor crcIn(7) xor crcIn(8) xor crcIn(16) xor crcIn(20) xor crcIn(22) xor crcIn(23) xor crcIn(26) xor signal_readdata(0) xor signal_readdata(1) xor signal_readdata(2) xor signal_readdata(3) xor signal_readdata(4) xor signal_readdata(6) xor signal_readdata(7) xor signal_readdata(8) xor signal_readdata(16) xor signal_readdata(20) xor signal_readdata(22) xor signal_readdata(23) xor signal_readdata(26);
|
||||
crcOut(1) <= crcIn(1) xor crcIn(2) xor crcIn(3) xor crcIn(4) xor crcIn(5) xor crcIn(7) xor crcIn(8) xor crcIn(9) xor crcIn(17) xor crcIn(21) xor crcIn(23) xor crcIn(24) xor crcIn(27) xor signal_readdata(1) xor signal_readdata(2) xor signal_readdata(3) xor signal_readdata(4) xor signal_readdata(5) xor signal_readdata(7) xor signal_readdata(8) xor signal_readdata(9) xor signal_readdata(17) xor signal_readdata(21) xor signal_readdata(23) xor signal_readdata(24) xor signal_readdata(27);
|
||||
crcOut(2) <= crcIn(0) xor crcIn(2) xor crcIn(3) xor crcIn(4) xor crcIn(5) xor crcIn(6) xor crcIn(8) xor crcIn(9) xor crcIn(10) xor crcIn(18) xor crcIn(22) xor crcIn(24) xor crcIn(25) xor crcIn(28) xor signal_readdata(0) xor signal_readdata(2) xor signal_readdata(3) xor signal_readdata(4) xor signal_readdata(5) xor signal_readdata(6) xor signal_readdata(8) xor signal_readdata(9) xor signal_readdata(10) xor signal_readdata(18) xor signal_readdata(22) xor signal_readdata(24) xor signal_readdata(25) xor signal_readdata(28);
|
||||
crcOut(3) <= crcIn(1) xor crcIn(3) xor crcIn(4) xor crcIn(5) xor crcIn(6) xor crcIn(7) xor crcIn(9) xor crcIn(10) xor crcIn(11) xor crcIn(19) xor crcIn(23) xor crcIn(25) xor crcIn(26) xor crcIn(29) xor signal_readdata(1) xor signal_readdata(3) xor signal_readdata(4) xor signal_readdata(5) xor signal_readdata(6) xor signal_readdata(7) xor signal_readdata(9) xor signal_readdata(10) xor signal_readdata(11) xor signal_readdata(19) xor signal_readdata(23) xor signal_readdata(25) xor signal_readdata(26) xor signal_readdata(29);
|
||||
crcOut(4) <= crcIn(2) xor crcIn(4) xor crcIn(5) xor crcIn(6) xor crcIn(7) xor crcIn(8) xor crcIn(10) xor crcIn(11) xor crcIn(12) xor crcIn(20) xor crcIn(24) xor crcIn(26) xor crcIn(27) xor crcIn(30) xor signal_readdata(2) xor signal_readdata(4) xor signal_readdata(5) xor signal_readdata(6) xor signal_readdata(7) xor signal_readdata(8) xor signal_readdata(10) xor signal_readdata(11) xor signal_readdata(12) xor signal_readdata(20) xor signal_readdata(24) xor signal_readdata(26) xor signal_readdata(27) xor signal_readdata(30);
|
||||
crcOut(5) <= crcIn(0) xor crcIn(3) xor crcIn(5) xor crcIn(6) xor crcIn(7) xor crcIn(8) xor crcIn(9) xor crcIn(11) xor crcIn(12) xor crcIn(13) xor crcIn(21) xor crcIn(25) xor crcIn(27) xor crcIn(28) xor crcIn(31) xor signal_readdata(0) xor signal_readdata(3) xor signal_readdata(5) xor signal_readdata(6) xor signal_readdata(7) xor signal_readdata(8) xor signal_readdata(9) xor signal_readdata(11) xor signal_readdata(12) xor signal_readdata(13) xor signal_readdata(21) xor signal_readdata(25) xor signal_readdata(27) xor signal_readdata(28) xor signal_readdata(31);
|
||||
crcOut(6) <= crcIn(0) xor crcIn(2) xor crcIn(3) xor crcIn(9) xor crcIn(10) xor crcIn(12) xor crcIn(13) xor crcIn(14) xor crcIn(16) xor crcIn(20) xor crcIn(23) xor crcIn(28) xor crcIn(29) xor signal_readdata(0) xor signal_readdata(2) xor signal_readdata(3) xor signal_readdata(9) xor signal_readdata(10) xor signal_readdata(12) xor signal_readdata(13) xor signal_readdata(14) xor signal_readdata(16) xor signal_readdata(20) xor signal_readdata(23) xor signal_readdata(28) xor signal_readdata(29);
|
||||
crcOut(7) <= crcIn(1) xor crcIn(3) xor crcIn(4) xor crcIn(10) xor crcIn(11) xor crcIn(13) xor crcIn(14) xor crcIn(15) xor crcIn(17) xor crcIn(21) xor crcIn(24) xor crcIn(29) xor crcIn(30) xor signal_readdata(1) xor signal_readdata(3) xor signal_readdata(4) xor signal_readdata(10) xor signal_readdata(11) xor signal_readdata(13) xor signal_readdata(14) xor signal_readdata(15) xor signal_readdata(17) xor signal_readdata(21) xor signal_readdata(24) xor signal_readdata(29) xor signal_readdata(30);
|
||||
crcOut(8) <= crcIn(0) xor crcIn(2) xor crcIn(4) xor crcIn(5) xor crcIn(11) xor crcIn(12) xor crcIn(14) xor crcIn(15) xor crcIn(16) xor crcIn(18) xor crcIn(22) xor crcIn(25) xor crcIn(30) xor crcIn(31) xor signal_readdata(0) xor signal_readdata(2) xor signal_readdata(4) xor signal_readdata(5) xor signal_readdata(11) xor signal_readdata(12) xor signal_readdata(14) xor signal_readdata(15) xor signal_readdata(16) xor signal_readdata(18) xor signal_readdata(22) xor signal_readdata(25) xor signal_readdata(30) xor signal_readdata(31);
|
||||
crcOut(9) <= crcIn(0) xor crcIn(2) xor crcIn(4) xor crcIn(5) xor crcIn(7) xor crcIn(8) xor crcIn(12) xor crcIn(13) xor crcIn(15) xor crcIn(17) xor crcIn(19) xor crcIn(20) xor crcIn(22) xor crcIn(31) xor signal_readdata(0) xor signal_readdata(2) xor signal_readdata(4) xor signal_readdata(5) xor signal_readdata(7) xor signal_readdata(8) xor signal_readdata(12) xor signal_readdata(13) xor signal_readdata(15) xor signal_readdata(17) xor signal_readdata(19) xor signal_readdata(20) xor signal_readdata(22) xor signal_readdata(31);
|
||||
crcOut(10) <= crcIn(0) xor crcIn(2) xor crcIn(4) xor crcIn(5) xor crcIn(7) xor crcIn(9) xor crcIn(13) xor crcIn(14) xor crcIn(18) xor crcIn(21) xor crcIn(22) xor crcIn(26) xor signal_readdata(0) xor signal_readdata(2) xor signal_readdata(4) xor signal_readdata(5) xor signal_readdata(7) xor signal_readdata(9) xor signal_readdata(13) xor signal_readdata(14) xor signal_readdata(18) xor signal_readdata(21) xor signal_readdata(22) xor signal_readdata(26);
|
||||
crcOut(11) <= crcIn(1) xor crcIn(3) xor crcIn(5) xor crcIn(6) xor crcIn(8) xor crcIn(10) xor crcIn(14) xor crcIn(15) xor crcIn(19) xor crcIn(22) xor crcIn(23) xor crcIn(27) xor signal_readdata(1) xor signal_readdata(3) xor signal_readdata(5) xor signal_readdata(6) xor signal_readdata(8) xor signal_readdata(10) xor signal_readdata(14) xor signal_readdata(15) xor signal_readdata(19) xor signal_readdata(22) xor signal_readdata(23) xor signal_readdata(27);
|
||||
crcOut(12) <= crcIn(2) xor crcIn(4) xor crcIn(6) xor crcIn(7) xor crcIn(9) xor crcIn(11) xor crcIn(15) xor crcIn(16) xor crcIn(20) xor crcIn(23) xor crcIn(24) xor crcIn(28) xor signal_readdata(2) xor signal_readdata(4) xor signal_readdata(6) xor signal_readdata(7) xor signal_readdata(9) xor signal_readdata(11) xor signal_readdata(15) xor signal_readdata(16) xor signal_readdata(20) xor signal_readdata(23) xor signal_readdata(24) xor signal_readdata(28);
|
||||
crcOut(13) <= crcIn(0) xor crcIn(3) xor crcIn(5) xor crcIn(7) xor crcIn(8) xor crcIn(10) xor crcIn(12) xor crcIn(16) xor crcIn(17) xor crcIn(21) xor crcIn(24) xor crcIn(25) xor crcIn(29) xor signal_readdata(0) xor signal_readdata(3) xor signal_readdata(5) xor signal_readdata(7) xor signal_readdata(8) xor signal_readdata(10) xor signal_readdata(12) xor signal_readdata(16) xor signal_readdata(17) xor signal_readdata(21) xor signal_readdata(24) xor signal_readdata(25) xor signal_readdata(29);
|
||||
crcOut(14) <= crcIn(0) xor crcIn(1) xor crcIn(4) xor crcIn(6) xor crcIn(8) xor crcIn(9) xor crcIn(11) xor crcIn(13) xor crcIn(17) xor crcIn(18) xor crcIn(22) xor crcIn(25) xor crcIn(26) xor crcIn(30) xor signal_readdata(0) xor signal_readdata(1) xor signal_readdata(4) xor signal_readdata(6) xor signal_readdata(8) xor signal_readdata(9) xor signal_readdata(11) xor signal_readdata(13) xor signal_readdata(17) xor signal_readdata(18) xor signal_readdata(22) xor signal_readdata(25) xor signal_readdata(26) xor signal_readdata(30);
|
||||
crcOut(15) <= crcIn(1) xor crcIn(2) xor crcIn(5) xor crcIn(7) xor crcIn(9) xor crcIn(10) xor crcIn(12) xor crcIn(14) xor crcIn(18) xor crcIn(19) xor crcIn(23) xor crcIn(26) xor crcIn(27) xor crcIn(31) xor signal_readdata(1) xor signal_readdata(2) xor signal_readdata(5) xor signal_readdata(7) xor signal_readdata(9) xor signal_readdata(10) xor signal_readdata(12) xor signal_readdata(14) xor signal_readdata(18) xor signal_readdata(19) xor signal_readdata(23) xor signal_readdata(26) xor signal_readdata(27) xor signal_readdata(31);
|
||||
crcOut(16) <= crcIn(1) xor crcIn(4) xor crcIn(7) xor crcIn(10) xor crcIn(11) xor crcIn(13) xor crcIn(15) xor crcIn(16) xor crcIn(19) xor crcIn(22) xor crcIn(23) xor crcIn(24) xor crcIn(26) xor crcIn(27) xor crcIn(28) xor signal_readdata(1) xor signal_readdata(4) xor signal_readdata(7) xor signal_readdata(10) xor signal_readdata(11) xor signal_readdata(13) xor signal_readdata(15) xor signal_readdata(16) xor signal_readdata(19) xor signal_readdata(22) xor signal_readdata(23) xor signal_readdata(24) xor signal_readdata(26) xor signal_readdata(27) xor signal_readdata(28);
|
||||
crcOut(17) <= crcIn(2) xor crcIn(5) xor crcIn(8) xor crcIn(11) xor crcIn(12) xor crcIn(14) xor crcIn(16) xor crcIn(17) xor crcIn(20) xor crcIn(23) xor crcIn(24) xor crcIn(25) xor crcIn(27) xor crcIn(28) xor crcIn(29) xor signal_readdata(2) xor signal_readdata(5) xor signal_readdata(8) xor signal_readdata(11) xor signal_readdata(12) xor signal_readdata(14) xor signal_readdata(16) xor signal_readdata(17) xor signal_readdata(20) xor signal_readdata(23) xor signal_readdata(24) xor signal_readdata(25) xor signal_readdata(27) xor signal_readdata(28) xor signal_readdata(29);
|
||||
crcOut(18) <= crcIn(0) xor crcIn(3) xor crcIn(6) xor crcIn(9) xor crcIn(12) xor crcIn(13) xor crcIn(15) xor crcIn(17) xor crcIn(18) xor crcIn(21) xor crcIn(24) xor crcIn(25) xor crcIn(26) xor crcIn(28) xor crcIn(29) xor crcIn(30) xor signal_readdata(0) xor signal_readdata(3) xor signal_readdata(6) xor signal_readdata(9) xor signal_readdata(12) xor signal_readdata(13) xor signal_readdata(15) xor signal_readdata(17) xor signal_readdata(18) xor signal_readdata(21) xor signal_readdata(24) xor signal_readdata(25) xor signal_readdata(26) xor signal_readdata(28) xor signal_readdata(29) xor signal_readdata(30);
|
||||
crcOut(19) <= crcIn(0) xor crcIn(1) xor crcIn(4) xor crcIn(7) xor crcIn(10) xor crcIn(13) xor crcIn(14) xor crcIn(16) xor crcIn(18) xor crcIn(19) xor crcIn(22) xor crcIn(25) xor crcIn(26) xor crcIn(27) xor crcIn(29) xor crcIn(30) xor crcIn(31) xor signal_readdata(0) xor signal_readdata(1) xor signal_readdata(4) xor signal_readdata(7) xor signal_readdata(10) xor signal_readdata(13) xor signal_readdata(14) xor signal_readdata(16) xor signal_readdata(18) xor signal_readdata(19) xor signal_readdata(22) xor signal_readdata(25) xor signal_readdata(26) xor signal_readdata(27) xor signal_readdata(29) xor signal_readdata(30) xor signal_readdata(31);
|
||||
crcOut(20) <= crcIn(0) xor crcIn(3) xor crcIn(4) xor crcIn(5) xor crcIn(6) xor crcIn(7) xor crcIn(11) xor crcIn(14) xor crcIn(15) xor crcIn(16) xor crcIn(17) xor crcIn(19) xor crcIn(22) xor crcIn(27) xor crcIn(28) xor crcIn(30) xor crcIn(31) xor signal_readdata(0) xor signal_readdata(3) xor signal_readdata(4) xor signal_readdata(5) xor signal_readdata(6) xor signal_readdata(7) xor signal_readdata(11) xor signal_readdata(14) xor signal_readdata(15) xor signal_readdata(16) xor signal_readdata(17) xor signal_readdata(19) xor signal_readdata(22) xor signal_readdata(27) xor signal_readdata(28) xor signal_readdata(30) xor signal_readdata(31);
|
||||
crcOut(21) <= crcIn(0) xor crcIn(2) xor crcIn(3) xor crcIn(5) xor crcIn(12) xor crcIn(15) xor crcIn(17) xor crcIn(18) xor crcIn(22) xor crcIn(26) xor crcIn(28) xor crcIn(29) xor crcIn(31) xor signal_readdata(0) xor signal_readdata(2) xor signal_readdata(3) xor signal_readdata(5) xor signal_readdata(12) xor signal_readdata(15) xor signal_readdata(17) xor signal_readdata(18) xor signal_readdata(22) xor signal_readdata(26) xor signal_readdata(28) xor signal_readdata(29) xor signal_readdata(31);
|
||||
crcOut(22) <= crcIn(2) xor crcIn(7) xor crcIn(8) xor crcIn(13) xor crcIn(18) xor crcIn(19) xor crcIn(20) xor crcIn(22) xor crcIn(26) xor crcIn(27) xor crcIn(29) xor crcIn(30) xor signal_readdata(2) xor signal_readdata(7) xor signal_readdata(8) xor signal_readdata(13) xor signal_readdata(18) xor signal_readdata(19) xor signal_readdata(20) xor signal_readdata(22) xor signal_readdata(26) xor signal_readdata(27) xor signal_readdata(29) xor signal_readdata(30);
|
||||
crcOut(23) <= crcIn(0) xor crcIn(3) xor crcIn(8) xor crcIn(9) xor crcIn(14) xor crcIn(19) xor crcIn(20) xor crcIn(21) xor crcIn(23) xor crcIn(27) xor crcIn(28) xor crcIn(30) xor crcIn(31) xor signal_readdata(0) xor signal_readdata(3) xor signal_readdata(8) xor signal_readdata(9) xor signal_readdata(14) xor signal_readdata(19) xor signal_readdata(20) xor signal_readdata(21) xor signal_readdata(23) xor signal_readdata(27) xor signal_readdata(28) xor signal_readdata(30) xor signal_readdata(31);
|
||||
crcOut(24) <= crcIn(2) xor crcIn(3) xor crcIn(6) xor crcIn(7) xor crcIn(8) xor crcIn(9) xor crcIn(10) xor crcIn(15) xor crcIn(16) xor crcIn(21) xor crcIn(23) xor crcIn(24) xor crcIn(26) xor crcIn(28) xor crcIn(29) xor crcIn(31) xor signal_readdata(2) xor signal_readdata(3) xor signal_readdata(6) xor signal_readdata(7) xor signal_readdata(8) xor signal_readdata(9) xor signal_readdata(10) xor signal_readdata(15) xor signal_readdata(16) xor signal_readdata(21) xor signal_readdata(23) xor signal_readdata(24) xor signal_readdata(26) xor signal_readdata(28) xor signal_readdata(29) xor signal_readdata(31);
|
||||
crcOut(25) <= crcIn(1) xor crcIn(2) xor crcIn(6) xor crcIn(9) xor crcIn(10) xor crcIn(11) xor crcIn(17) xor crcIn(20) xor crcIn(23) xor crcIn(24) xor crcIn(25) xor crcIn(26) xor crcIn(27) xor crcIn(29) xor crcIn(30) xor signal_readdata(1) xor signal_readdata(2) xor signal_readdata(6) xor signal_readdata(9) xor signal_readdata(10) xor signal_readdata(11) xor signal_readdata(17) xor signal_readdata(20) xor signal_readdata(23) xor signal_readdata(24) xor signal_readdata(25) xor signal_readdata(26) xor signal_readdata(27) xor signal_readdata(29) xor signal_readdata(30);
|
||||
crcOut(26) <= crcIn(2) xor crcIn(3) xor crcIn(7) xor crcIn(10) xor crcIn(11) xor crcIn(12) xor crcIn(18) xor crcIn(21) xor crcIn(24) xor crcIn(25) xor crcIn(26) xor crcIn(27) xor crcIn(28) xor crcIn(30) xor crcIn(31) xor signal_readdata(2) xor signal_readdata(3) xor signal_readdata(7) xor signal_readdata(10) xor signal_readdata(11) xor signal_readdata(12) xor signal_readdata(18) xor signal_readdata(21) xor signal_readdata(24) xor signal_readdata(25) xor signal_readdata(26) xor signal_readdata(27) xor signal_readdata(28) xor signal_readdata(30) xor signal_readdata(31);
|
||||
crcOut(27) <= crcIn(0) xor crcIn(1) xor crcIn(2) xor crcIn(6) xor crcIn(7) xor crcIn(11) xor crcIn(12) xor crcIn(13) xor crcIn(16) xor crcIn(19) xor crcIn(20) xor crcIn(23) xor crcIn(25) xor crcIn(27) xor crcIn(28) xor crcIn(29) xor crcIn(31) xor signal_readdata(0) xor signal_readdata(1) xor signal_readdata(2) xor signal_readdata(6) xor signal_readdata(7) xor signal_readdata(11) xor signal_readdata(12) xor signal_readdata(13) xor signal_readdata(16) xor signal_readdata(19) xor signal_readdata(20) xor signal_readdata(23) xor signal_readdata(25) xor signal_readdata(27) xor signal_readdata(28) xor signal_readdata(29) xor signal_readdata(31);
|
||||
crcOut(28) <= crcIn(0) xor crcIn(4) xor crcIn(6) xor crcIn(12) xor crcIn(13) xor crcIn(14) xor crcIn(16) xor crcIn(17) xor crcIn(21) xor crcIn(22) xor crcIn(23) xor crcIn(24) xor crcIn(28) xor crcIn(29) xor crcIn(30) xor signal_readdata(0) xor signal_readdata(4) xor signal_readdata(6) xor signal_readdata(12) xor signal_readdata(13) xor signal_readdata(14) xor signal_readdata(16) xor signal_readdata(17) xor signal_readdata(21) xor signal_readdata(22) xor signal_readdata(23) xor signal_readdata(24) xor signal_readdata(28) xor signal_readdata(29) xor signal_readdata(30);
|
||||
crcOut(29) <= crcIn(0) xor crcIn(1) xor crcIn(5) xor crcIn(7) xor crcIn(13) xor crcIn(14) xor crcIn(15) xor crcIn(17) xor crcIn(18) xor crcIn(22) xor crcIn(23) xor crcIn(24) xor crcIn(25) xor crcIn(29) xor crcIn(30) xor crcIn(31) xor signal_readdata(0) xor signal_readdata(1) xor signal_readdata(5) xor signal_readdata(7) xor signal_readdata(13) xor signal_readdata(14) xor signal_readdata(15) xor signal_readdata(17) xor signal_readdata(18) xor signal_readdata(22) xor signal_readdata(23) xor signal_readdata(24) xor signal_readdata(25) xor signal_readdata(29) xor signal_readdata(30) xor signal_readdata(31);
|
||||
crcOut(30) <= crcIn(3) xor crcIn(4) xor crcIn(7) xor crcIn(14) xor crcIn(15) xor crcIn(18) xor crcIn(19) xor crcIn(20) xor crcIn(22) xor crcIn(24) xor crcIn(25) xor crcIn(30) xor crcIn(31) xor signal_readdata(3) xor signal_readdata(4) xor signal_readdata(7) xor signal_readdata(14) xor signal_readdata(15) xor signal_readdata(18) xor signal_readdata(19) xor signal_readdata(20) xor signal_readdata(22) xor signal_readdata(24) xor signal_readdata(25) xor signal_readdata(30) xor signal_readdata(31);
|
||||
crcOut(31) <= crcIn(0) xor crcIn(1) xor crcIn(2) xor crcIn(3) xor crcIn(5) xor crcIn(6) xor crcIn(7) xor crcIn(15) xor crcIn(19) xor crcIn(21) xor crcIn(22) xor crcIn(25) xor crcIn(31) xor signal_readdata(0) xor signal_readdata(1) xor signal_readdata(2) xor signal_readdata(3) xor signal_readdata(5) xor signal_readdata(6) xor signal_readdata(7) xor signal_readdata(15) xor signal_readdata(19) xor signal_readdata(21) xor signal_readdata(22) xor signal_readdata(25) xor signal_readdata(31);
|
||||
|
||||
crc_state <= 2; --Calc Zustand aendern
|
||||
when 2 =>
|
||||
if ( current_task_state = work.task.TASK_DONE ) then
|
||||
signal_writedata <= not crcOut; --Ergebnis invertieren
|
||||
signal_write <= '1';
|
||||
end if;
|
||||
|
||||
flag_index <= '1'; --flag_index sagt nur, dass der index hochgezaehlt werden soll
|
||||
crc_state <= 0; --Calc Zustand aendern
|
||||
-- assign new crc value
|
||||
crcIn <= crcOut;
|
||||
|
||||
end case;
|
||||
end if;
|
||||
end process crc_calc;
|
||||
|
||||
|
||||
task_state <= current_task_state;
|
||||
|
||||
end architecture rtl;
|
||||
|
@ -26,12 +26,46 @@ end entity sine;
|
||||
|
||||
architecture rtl of sine is
|
||||
|
||||
signal current_task_state : work.task.State;
|
||||
signal current_task_state : work.task.State; --multiple sources
|
||||
signal next_task_state : work.task.State;
|
||||
signal index : integer range 0 to work.task.STREAM_LEN;
|
||||
signal index : integer range 0 to work.task.STREAM_LEN; --multiple sources
|
||||
|
||||
--Selbst angelegte Signal:
|
||||
signal data_valid_flag : std_logic;
|
||||
signal busy_flag : std_logic;
|
||||
signal result_valid_flag : std_logic;
|
||||
signal angle_sig : signed( 31 downto 0);
|
||||
signal ergebnis : signed( 31 downto 0 );
|
||||
signal ampl_sig : signed( 31 downto 0 );
|
||||
|
||||
--Zustände für die Zustandsmaschine für die Berechnung
|
||||
type CalcState is (
|
||||
CALC_IDLE,
|
||||
CALC_START,
|
||||
CALC_SINE,
|
||||
CALC_STORE_RESULT
|
||||
);
|
||||
--Signale für die Zustandsmaschine für die Berechnung
|
||||
signal current_calc_state : CalcState;
|
||||
signal next_calc_state : CalcState;
|
||||
|
||||
begin
|
||||
task_state_transitions : process ( current_task_state, task_start, index ) is
|
||||
u_float_sine : entity work.float_sine -- Das hier ist der Core!
|
||||
generic map (
|
||||
ITERATIONS => 8
|
||||
)
|
||||
port map (
|
||||
clk => clk,
|
||||
reset => reset,
|
||||
data_valid => data_valid_flag, --# load new input data
|
||||
busy => busy_flag, --# generating new result
|
||||
result_valid => result_valid_flag, --# flag when result is valid
|
||||
angle => angle_sig, -- angle in brads (2**size brads = 2*pi radians)
|
||||
sine => ergebnis --Hierzu nachfragen
|
||||
);
|
||||
|
||||
--Bei diesem task nichts ändern!
|
||||
task_state_transitions : process ( all ) is
|
||||
begin
|
||||
next_task_state <= current_task_state;
|
||||
case current_task_state is
|
||||
@ -50,28 +84,82 @@ begin
|
||||
end case;
|
||||
end process task_state_transitions;
|
||||
|
||||
sync : process ( clk, reset ) is
|
||||
begin
|
||||
if ( reset = '1' ) then
|
||||
current_task_state <= work.task.TASK_IDLE;
|
||||
index <= 0;
|
||||
elsif ( rising_edge( clk ) ) then
|
||||
current_task_state <= next_task_state;
|
||||
case next_task_state is
|
||||
when work.task.TASK_IDLE =>
|
||||
index <= 0;
|
||||
signal_write <= '0';
|
||||
when work.task.TASK_RUNNING =>
|
||||
index <= index + 1;
|
||||
signal_write <= '1';
|
||||
signal_writedata <= ( others => '0' );
|
||||
when work.task.TASK_DONE =>
|
||||
index <= 0;
|
||||
signal_write <= '0';
|
||||
end case;
|
||||
end if;
|
||||
end process sync;
|
||||
|
||||
task_state <= current_task_state;
|
||||
--Übergangsschaltnetz der Zustandsmaschine für die Berechnung ###Fertig
|
||||
calc_state_transitions: process (all) is
|
||||
begin
|
||||
next_calc_state <= current_calc_state;
|
||||
case current_calc_state is
|
||||
when CALC_IDLE=>
|
||||
if (current_task_state= work.task.TASK_RUNNING) then
|
||||
next_calc_state <= CALC_START;
|
||||
end if;
|
||||
when CALC_START=>
|
||||
next_calc_state <= CALC_SINE;
|
||||
when CALC_SINE =>
|
||||
if (result_valid_flag = '1' and busy_flag = '0') then --or falling_edge( busy) ?
|
||||
next_calc_state <= CALC_STORE_RESULT;
|
||||
end if;
|
||||
when CALC_STORE_RESULT =>
|
||||
if ( index = work.task.STREAM_LEN ) then
|
||||
next_calc_state <= CALC_IDLE;
|
||||
else
|
||||
next_calc_state <= CALC_START;
|
||||
end if;
|
||||
end case;
|
||||
end process calc_state_transitions;
|
||||
|
||||
|
||||
--Zustandsspeicher und Ausgangsschaltnetz zu der Steuerung der Tasks
|
||||
task_sync : process (clk, reset) is
|
||||
begin
|
||||
if (reset = '1') then
|
||||
current_task_state <= work.task.TASK_IDLE;
|
||||
|
||||
elsif (rising_edge( clk)) then
|
||||
current_task_state <= next_task_state;
|
||||
case next_task_state is
|
||||
when work.task. TASK_IDLE => null;
|
||||
when work.task. TASK_RUNNING => null;
|
||||
when work.task. TASK_DONE => null;
|
||||
end case;
|
||||
end if;
|
||||
end process task_sync;
|
||||
|
||||
--Zustandsspeicher und Ausgangsschaltnetz zu Berechnung
|
||||
sync : process (clk, reset) is
|
||||
begin
|
||||
if (reset = '1') then
|
||||
index <= 0;
|
||||
data_valid_flag <= '0';
|
||||
current_calc_state <= CALC_IDLE;
|
||||
--ergebnis <= (others => '0'); --Wird von IP Core gesteuert und darf deshalb hier nicht getrieben werden
|
||||
signal_writedata <= (others => '0');
|
||||
signal_write <= '0';
|
||||
angle_sig <= (others => '0');
|
||||
elsif (rising_edge( clk)) then
|
||||
current_calc_state <= next_calc_state;
|
||||
case next_calc_state is
|
||||
when CALC_IDLE =>
|
||||
data_valid_flag <= '0';
|
||||
signal_write <= '0';
|
||||
angle_sig <= signed (phase);
|
||||
ampl_sig <= signed (amplitude);
|
||||
when CALC_START =>
|
||||
data_valid_flag <= '1';
|
||||
signal_write <= '0';
|
||||
angle_sig <= angle_sig + signed(step_size); --step_size = 2 * PI / 32
|
||||
when CALC_SINE => --hier Berechnung mit IP Core?
|
||||
data_valid_flag <= '0';
|
||||
when CALC_STORE_RESULT =>
|
||||
index <= index + 1;
|
||||
signal_write <= '1';
|
||||
--Berechne float multiplikation zu Fuss. Exponent + Exponent usw.
|
||||
signal_writedata <= std_logic_vector( ergebnis(31 downto 31) & (ergebnis(30 downto 23) + (signed(ampl_sig(30 downto 23)) - 127)) & ergebnis(22 downto 0));
|
||||
|
||||
end case;
|
||||
end if;
|
||||
end process sync;
|
||||
task_state <= current_task_state;
|
||||
|
||||
end architecture rtl;
|
||||
|
69
hardware/system/crc_core.vhd
Normal file
69
hardware/system/crc_core.vhd
Normal file
@ -0,0 +1,69 @@
|
||||
-- vim: ts=4 sw=4 expandtab
|
||||
|
||||
-- THIS IS GENERATED VHDL CODE.
|
||||
-- https://bues.ch/h/crcgen
|
||||
--
|
||||
-- This code is Public Domain.
|
||||
-- Permission to use, copy, modify, and/or distribute this software for any
|
||||
-- purpose with or without fee is hereby granted.
|
||||
--
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
-- SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
-- RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
-- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
-- USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
-- CRC polynomial coefficients: x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1
|
||||
-- 0xEDB88320 (hex)
|
||||
-- CRC width: 32 bits
|
||||
-- CRC shift direction: right (little endian)
|
||||
-- Input word width: 8 bits
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
|
||||
entity crc_core is
|
||||
port (
|
||||
crcIn: in std_logic_vector(31 downto 0);
|
||||
data: in std_logic_vector(7 downto 0);
|
||||
crcOut: out std_logic_vector(31 downto 0)
|
||||
);
|
||||
end entity crc_core;
|
||||
|
||||
architecture Behavioral of crc_core is
|
||||
begin
|
||||
crcOut(0) <= crcIn(2) xor crcIn(8) xor data(2);
|
||||
crcOut(1) <= crcIn(0) xor crcIn(3) xor crcIn(9) xor data(0) xor data(3);
|
||||
crcOut(2) <= crcIn(0) xor crcIn(1) xor crcIn(4) xor crcIn(10) xor data(0) xor data(1) xor data(4);
|
||||
crcOut(3) <= crcIn(1) xor crcIn(2) xor crcIn(5) xor crcIn(11) xor data(1) xor data(2) xor data(5);
|
||||
crcOut(4) <= crcIn(0) xor crcIn(2) xor crcIn(3) xor crcIn(6) xor crcIn(12) xor data(0) xor data(2) xor data(3) xor data(6);
|
||||
crcOut(5) <= crcIn(1) xor crcIn(3) xor crcIn(4) xor crcIn(7) xor crcIn(13) xor data(1) xor data(3) xor data(4) xor data(7);
|
||||
crcOut(6) <= crcIn(4) xor crcIn(5) xor crcIn(14) xor data(4) xor data(5);
|
||||
crcOut(7) <= crcIn(0) xor crcIn(5) xor crcIn(6) xor crcIn(15) xor data(0) xor data(5) xor data(6);
|
||||
crcOut(8) <= crcIn(1) xor crcIn(6) xor crcIn(7) xor crcIn(16) xor data(1) xor data(6) xor data(7);
|
||||
crcOut(9) <= crcIn(7) xor crcIn(17) xor data(7);
|
||||
crcOut(10) <= crcIn(2) xor crcIn(18) xor data(2);
|
||||
crcOut(11) <= crcIn(3) xor crcIn(19) xor data(3);
|
||||
crcOut(12) <= crcIn(0) xor crcIn(4) xor crcIn(20) xor data(0) xor data(4);
|
||||
crcOut(13) <= crcIn(0) xor crcIn(1) xor crcIn(5) xor crcIn(21) xor data(0) xor data(1) xor data(5);
|
||||
crcOut(14) <= crcIn(1) xor crcIn(2) xor crcIn(6) xor crcIn(22) xor data(1) xor data(2) xor data(6);
|
||||
crcOut(15) <= crcIn(2) xor crcIn(3) xor crcIn(7) xor crcIn(23) xor data(2) xor data(3) xor data(7);
|
||||
crcOut(16) <= crcIn(0) xor crcIn(2) xor crcIn(3) xor crcIn(4) xor crcIn(24) xor data(0) xor data(2) xor data(3) xor data(4);
|
||||
crcOut(17) <= crcIn(0) xor crcIn(1) xor crcIn(3) xor crcIn(4) xor crcIn(5) xor crcIn(25) xor data(0) xor data(1) xor data(3) xor data(4) xor data(5);
|
||||
crcOut(18) <= crcIn(0) xor crcIn(1) xor crcIn(2) xor crcIn(4) xor crcIn(5) xor crcIn(6) xor crcIn(26) xor data(0) xor data(1) xor data(2) xor data(4) xor data(5) xor data(6);
|
||||
crcOut(19) <= crcIn(1) xor crcIn(2) xor crcIn(3) xor crcIn(5) xor crcIn(6) xor crcIn(7) xor crcIn(27) xor data(1) xor data(2) xor data(3) xor data(5) xor data(6) xor data(7);
|
||||
crcOut(20) <= crcIn(3) xor crcIn(4) xor crcIn(6) xor crcIn(7) xor crcIn(28) xor data(3) xor data(4) xor data(6) xor data(7);
|
||||
crcOut(21) <= crcIn(2) xor crcIn(4) xor crcIn(5) xor crcIn(7) xor crcIn(29) xor data(2) xor data(4) xor data(5) xor data(7);
|
||||
crcOut(22) <= crcIn(2) xor crcIn(3) xor crcIn(5) xor crcIn(6) xor crcIn(30) xor data(2) xor data(3) xor data(5) xor data(6);
|
||||
crcOut(23) <= crcIn(3) xor crcIn(4) xor crcIn(6) xor crcIn(7) xor crcIn(31) xor data(3) xor data(4) xor data(6) xor data(7);
|
||||
crcOut(24) <= crcIn(0) xor crcIn(2) xor crcIn(4) xor crcIn(5) xor crcIn(7) xor data(0) xor data(2) xor data(4) xor data(5) xor data(7);
|
||||
crcOut(25) <= crcIn(0) xor crcIn(1) xor crcIn(2) xor crcIn(3) xor crcIn(5) xor crcIn(6) xor data(0) xor data(1) xor data(2) xor data(3) xor data(5) xor data(6);
|
||||
crcOut(26) <= crcIn(0) xor crcIn(1) xor crcIn(2) xor crcIn(3) xor crcIn(4) xor crcIn(6) xor crcIn(7) xor data(0) xor data(1) xor data(2) xor data(3) xor data(4) xor data(6) xor data(7);
|
||||
crcOut(27) <= crcIn(1) xor crcIn(3) xor crcIn(4) xor crcIn(5) xor crcIn(7) xor data(1) xor data(3) xor data(4) xor data(5) xor data(7);
|
||||
crcOut(28) <= crcIn(0) xor crcIn(4) xor crcIn(5) xor crcIn(6) xor data(0) xor data(4) xor data(5) xor data(6);
|
||||
crcOut(29) <= crcIn(0) xor crcIn(1) xor crcIn(5) xor crcIn(6) xor crcIn(7) xor data(0) xor data(1) xor data(5) xor data(6) xor data(7);
|
||||
crcOut(30) <= crcIn(0) xor crcIn(1) xor crcIn(6) xor crcIn(7) xor data(0) xor data(1) xor data(6) xor data(7);
|
||||
crcOut(31) <= crcIn(1) xor crcIn(7) xor data(1) xor data(7);
|
||||
end architecture Behavioral;
|
@ -42,7 +42,7 @@ set_global_assignment -name DEVICE 5CSEBA6U23I7
|
||||
set_global_assignment -name TOP_LEVEL_ENTITY signal_processing
|
||||
set_global_assignment -name ORIGINAL_QUARTUS_VERSION 20.1.1
|
||||
set_global_assignment -name PROJECT_CREATION_TIME_DATE "23:07:58 JUNE 12, 2022"
|
||||
set_global_assignment -name LAST_QUARTUS_VERSION "21.1.1 Lite Edition"
|
||||
set_global_assignment -name LAST_QUARTUS_VERSION "22.1std.1 Standard Edition"
|
||||
set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output_files
|
||||
set_global_assignment -name ERROR_CHECK_FREQUENCY_DIVISOR 256
|
||||
set_global_assignment -name EDA_SIMULATION_TOOL "<None>"
|
||||
|
806
signal_processing_assignment_defaults.qdf
Normal file
806
signal_processing_assignment_defaults.qdf
Normal file
@ -0,0 +1,806 @@
|
||||
# -------------------------------------------------------------------------- #
|
||||
#
|
||||
# Copyright (C) 2023 Intel Corporation. All rights reserved.
|
||||
# Your use of Intel Corporation's design tools, logic functions
|
||||
# and other software and tools, and any partner logic
|
||||
# functions, and any output files from any of the foregoing
|
||||
# (including device programming or simulation files), and any
|
||||
# associated documentation or information are expressly subject
|
||||
# to the terms and conditions of the Intel Program License
|
||||
# Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
# the Intel FPGA IP License Agreement, or other applicable license
|
||||
# agreement, including, without limitation, that your use is for
|
||||
# the sole purpose of programming logic devices manufactured by
|
||||
# Intel and sold by Intel or its authorized distributors. Please
|
||||
# refer to the applicable agreement for further details, at
|
||||
# https://fpgasoftware.intel.com/eula.
|
||||
#
|
||||
# -------------------------------------------------------------------------- #
|
||||
#
|
||||
# Quartus Prime
|
||||
# Version 22.1std.1 Build 917 02/14/2023 SC Standard Edition
|
||||
# Date created = 09:28:39 December 18, 2024
|
||||
#
|
||||
# -------------------------------------------------------------------------- #
|
||||
#
|
||||
# Note:
|
||||
#
|
||||
# 1) Do not modify this file. This file was generated
|
||||
# automatically by the Quartus Prime software and is used
|
||||
# to preserve global assignments across Quartus Prime versions.
|
||||
#
|
||||
# -------------------------------------------------------------------------- #
|
||||
|
||||
set_global_assignment -name IP_COMPONENT_REPORT_HIERARCHY Off
|
||||
set_global_assignment -name IP_COMPONENT_INTERNAL Off
|
||||
set_global_assignment -name PROJECT_SHOW_ENTITY_NAME On
|
||||
set_global_assignment -name PROJECT_USE_SIMPLIFIED_NAMES Off
|
||||
set_global_assignment -name ENABLE_REDUCED_MEMORY_MODE Off
|
||||
set_global_assignment -name VER_COMPATIBLE_DB_DIR export_db
|
||||
set_global_assignment -name AUTO_EXPORT_VER_COMPATIBLE_DB Off
|
||||
set_global_assignment -name FLOW_DISABLE_ASSEMBLER Off
|
||||
set_global_assignment -name FLOW_ENABLE_POWER_ANALYZER Off
|
||||
set_global_assignment -name FLOW_ENABLE_HC_COMPARE Off
|
||||
set_global_assignment -name HC_OUTPUT_DIR hc_output
|
||||
set_global_assignment -name SAVE_MIGRATION_INFO_DURING_COMPILATION Off
|
||||
set_global_assignment -name FLOW_ENABLE_IO_ASSIGNMENT_ANALYSIS Off
|
||||
set_global_assignment -name RUN_FULL_COMPILE_ON_DEVICE_CHANGE On
|
||||
set_global_assignment -name FLOW_ENABLE_RTL_VIEWER Off
|
||||
set_global_assignment -name READ_OR_WRITE_IN_BYTE_ADDRESS "Use global settings"
|
||||
set_global_assignment -name FLOW_HARDCOPY_DESIGN_READINESS_CHECK On
|
||||
set_global_assignment -name FLOW_ENABLE_PARALLEL_MODULES On
|
||||
set_global_assignment -name ENABLE_COMPACT_REPORT_TABLE Off
|
||||
set_global_assignment -name REVISION_TYPE Base -family "Arria V"
|
||||
set_global_assignment -name REVISION_TYPE Base -family "Stratix V"
|
||||
set_global_assignment -name REVISION_TYPE Base -family "Arria V GZ"
|
||||
set_global_assignment -name REVISION_TYPE Base -family "Cyclone V"
|
||||
set_global_assignment -name DEFAULT_HOLD_MULTICYCLE "Same as Multicycle"
|
||||
set_global_assignment -name CUT_OFF_PATHS_BETWEEN_CLOCK_DOMAINS On
|
||||
set_global_assignment -name CUT_OFF_READ_DURING_WRITE_PATHS On
|
||||
set_global_assignment -name CUT_OFF_IO_PIN_FEEDBACK On
|
||||
set_global_assignment -name DO_COMBINED_ANALYSIS Off
|
||||
set_global_assignment -name TDC_AGGRESSIVE_HOLD_CLOSURE_EFFORT Off
|
||||
set_global_assignment -name ENABLE_HPS_INTERNAL_TIMING Off
|
||||
set_global_assignment -name EMIF_SOC_PHYCLK_ADVANCE_MODELING Off
|
||||
set_global_assignment -name USE_DLL_FREQUENCY_FOR_DQS_DELAY_CHAIN Off
|
||||
set_global_assignment -name ANALYZE_LATCHES_AS_SYNCHRONOUS_ELEMENTS On
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_SCRIPT_INCLUDE_DEFAULT_ANALYSIS On
|
||||
set_global_assignment -name TIMING_ANALYZER_MULTICORNER_ANALYSIS On -family "Arria V"
|
||||
set_global_assignment -name TIMING_ANALYZER_MULTICORNER_ANALYSIS On -family "Cyclone 10 LP"
|
||||
set_global_assignment -name TIMING_ANALYZER_MULTICORNER_ANALYSIS On -family "MAX 10"
|
||||
set_global_assignment -name TIMING_ANALYZER_MULTICORNER_ANALYSIS On -family "Stratix IV"
|
||||
set_global_assignment -name TIMING_ANALYZER_MULTICORNER_ANALYSIS On -family "Cyclone IV E"
|
||||
set_global_assignment -name TIMING_ANALYZER_MULTICORNER_ANALYSIS On -family "Arria 10"
|
||||
set_global_assignment -name TIMING_ANALYZER_MULTICORNER_ANALYSIS Off -family "MAX V"
|
||||
set_global_assignment -name TIMING_ANALYZER_MULTICORNER_ANALYSIS On -family "Stratix V"
|
||||
set_global_assignment -name TIMING_ANALYZER_MULTICORNER_ANALYSIS On -family "Arria V GZ"
|
||||
set_global_assignment -name TIMING_ANALYZER_MULTICORNER_ANALYSIS Off -family "MAX II"
|
||||
set_global_assignment -name TIMING_ANALYZER_MULTICORNER_ANALYSIS On -family "Arria II GX"
|
||||
set_global_assignment -name TIMING_ANALYZER_MULTICORNER_ANALYSIS On -family "Arria II GZ"
|
||||
set_global_assignment -name TIMING_ANALYZER_MULTICORNER_ANALYSIS On -family "Cyclone IV GX"
|
||||
set_global_assignment -name TIMING_ANALYZER_MULTICORNER_ANALYSIS On -family "Cyclone V"
|
||||
set_global_assignment -name TIMING_ANALYZER_DO_REPORT_TIMING Off
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_WORST_CASE_TIMING_PATHS Off -family "Arria V"
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_WORST_CASE_TIMING_PATHS On -family "Cyclone 10 LP"
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_WORST_CASE_TIMING_PATHS Off -family "MAX 10"
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_WORST_CASE_TIMING_PATHS Off -family "Stratix IV"
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_WORST_CASE_TIMING_PATHS On -family "Cyclone IV E"
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_WORST_CASE_TIMING_PATHS Off -family "Arria 10"
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_WORST_CASE_TIMING_PATHS On -family "MAX V"
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_WORST_CASE_TIMING_PATHS Off -family "Stratix V"
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_WORST_CASE_TIMING_PATHS Off -family "Arria V GZ"
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_WORST_CASE_TIMING_PATHS On -family "MAX II"
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_WORST_CASE_TIMING_PATHS Off -family "Arria II GX"
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_WORST_CASE_TIMING_PATHS Off -family "Arria II GZ"
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_WORST_CASE_TIMING_PATHS On -family "Cyclone IV GX"
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_WORST_CASE_TIMING_PATHS Off -family "Cyclone V"
|
||||
set_global_assignment -name TIMING_ANALYZER_REPORT_NUM_WORST_CASE_TIMING_PATHS 100
|
||||
set_global_assignment -name TIMING_ANALYZER_DO_CCPP_REMOVAL On -family "Arria V"
|
||||
set_global_assignment -name TIMING_ANALYZER_DO_CCPP_REMOVAL On -family "Cyclone 10 LP"
|
||||
set_global_assignment -name TIMING_ANALYZER_DO_CCPP_REMOVAL On -family "MAX 10"
|
||||
set_global_assignment -name TIMING_ANALYZER_DO_CCPP_REMOVAL On -family "Cyclone IV E"
|
||||
set_global_assignment -name TIMING_ANALYZER_DO_CCPP_REMOVAL On -family "Stratix IV"
|
||||
set_global_assignment -name TIMING_ANALYZER_DO_CCPP_REMOVAL On -family "Arria 10"
|
||||
set_global_assignment -name TIMING_ANALYZER_DO_CCPP_REMOVAL Off -family "MAX V"
|
||||
set_global_assignment -name TIMING_ANALYZER_DO_CCPP_REMOVAL On -family "Stratix V"
|
||||
set_global_assignment -name TIMING_ANALYZER_DO_CCPP_REMOVAL On -family "Arria V GZ"
|
||||
set_global_assignment -name TIMING_ANALYZER_DO_CCPP_REMOVAL Off -family "MAX II"
|
||||
set_global_assignment -name TIMING_ANALYZER_DO_CCPP_REMOVAL On -family "Arria II GX"
|
||||
set_global_assignment -name TIMING_ANALYZER_DO_CCPP_REMOVAL On -family "Arria II GZ"
|
||||
set_global_assignment -name TIMING_ANALYZER_DO_CCPP_REMOVAL On -family "Cyclone IV GX"
|
||||
set_global_assignment -name TIMING_ANALYZER_DO_CCPP_REMOVAL On -family "Cyclone V"
|
||||
set_global_assignment -name OPTIMIZATION_MODE Balanced
|
||||
set_global_assignment -name ALLOW_REGISTER_MERGING On
|
||||
set_global_assignment -name ALLOW_REGISTER_DUPLICATION On
|
||||
set_global_assignment -name DISABLE_LEGACY_TIMING_ANALYZER OFF -family "Arria V"
|
||||
set_global_assignment -name DISABLE_LEGACY_TIMING_ANALYZER ON -family "Cyclone 10 LP"
|
||||
set_global_assignment -name DISABLE_LEGACY_TIMING_ANALYZER OFF -family "MAX 10"
|
||||
set_global_assignment -name DISABLE_LEGACY_TIMING_ANALYZER OFF -family "Stratix IV"
|
||||
set_global_assignment -name DISABLE_LEGACY_TIMING_ANALYZER OFF -family "Cyclone IV E"
|
||||
set_global_assignment -name DISABLE_LEGACY_TIMING_ANALYZER ON -family "Arria 10"
|
||||
set_global_assignment -name DISABLE_LEGACY_TIMING_ANALYZER OFF -family "MAX V"
|
||||
set_global_assignment -name DISABLE_LEGACY_TIMING_ANALYZER OFF -family "Stratix V"
|
||||
set_global_assignment -name DISABLE_LEGACY_TIMING_ANALYZER OFF -family "Arria V GZ"
|
||||
set_global_assignment -name DISABLE_LEGACY_TIMING_ANALYZER OFF -family "MAX II"
|
||||
set_global_assignment -name DISABLE_LEGACY_TIMING_ANALYZER OFF -family "Arria II GX"
|
||||
set_global_assignment -name DISABLE_LEGACY_TIMING_ANALYZER OFF -family "Arria II GZ"
|
||||
set_global_assignment -name DISABLE_LEGACY_TIMING_ANALYZER OFF -family "Cyclone IV GX"
|
||||
set_global_assignment -name DISABLE_LEGACY_TIMING_ANALYZER OFF -family "Cyclone V"
|
||||
set_global_assignment -name MUX_RESTRUCTURE Auto
|
||||
set_global_assignment -name MLAB_ADD_TIMING_CONSTRAINTS_FOR_MIXED_PORT_FEED_THROUGH_MODE_SETTING_DONT_CARE Off
|
||||
set_global_assignment -name ENABLE_IP_DEBUG Off
|
||||
set_global_assignment -name SAVE_DISK_SPACE On
|
||||
set_global_assignment -name OCP_HW_EVAL Enable
|
||||
set_global_assignment -name DEVICE_FILTER_PACKAGE Any
|
||||
set_global_assignment -name DEVICE_FILTER_PIN_COUNT Any
|
||||
set_global_assignment -name DEVICE_FILTER_SPEED_GRADE Any
|
||||
set_global_assignment -name EDA_DESIGN_ENTRY_SYNTHESIS_TOOL "<None>"
|
||||
set_global_assignment -name VERILOG_INPUT_VERSION Verilog_2001
|
||||
set_global_assignment -name VHDL_INPUT_VERSION VHDL_1993
|
||||
set_global_assignment -name FAMILY "Cyclone V"
|
||||
set_global_assignment -name TRUE_WYSIWYG_FLOW Off
|
||||
set_global_assignment -name SMART_COMPILE_IGNORES_TDC_FOR_STRATIX_PLL_CHANGES Off
|
||||
set_global_assignment -name STATE_MACHINE_PROCESSING Auto
|
||||
set_global_assignment -name SAFE_STATE_MACHINE Off
|
||||
set_global_assignment -name EXTRACT_VERILOG_STATE_MACHINES On
|
||||
set_global_assignment -name EXTRACT_VHDL_STATE_MACHINES On
|
||||
set_global_assignment -name IGNORE_VERILOG_INITIAL_CONSTRUCTS Off
|
||||
set_global_assignment -name VERILOG_CONSTANT_LOOP_LIMIT 5000
|
||||
set_global_assignment -name VERILOG_NON_CONSTANT_LOOP_LIMIT 250
|
||||
set_global_assignment -name INFER_RAMS_FROM_RAW_LOGIC On
|
||||
set_global_assignment -name PARALLEL_SYNTHESIS On
|
||||
set_global_assignment -name DSP_BLOCK_BALANCING Auto
|
||||
set_global_assignment -name MAX_BALANCING_DSP_BLOCKS "-1 (Unlimited)"
|
||||
set_global_assignment -name NOT_GATE_PUSH_BACK On
|
||||
set_global_assignment -name ALLOW_POWER_UP_DONT_CARE On
|
||||
set_global_assignment -name REMOVE_REDUNDANT_LOGIC_CELLS Off
|
||||
set_global_assignment -name REMOVE_DUPLICATE_REGISTERS On
|
||||
set_global_assignment -name IGNORE_CARRY_BUFFERS Off
|
||||
set_global_assignment -name IGNORE_CASCADE_BUFFERS Off
|
||||
set_global_assignment -name IGNORE_GLOBAL_BUFFERS Off
|
||||
set_global_assignment -name IGNORE_ROW_GLOBAL_BUFFERS Off
|
||||
set_global_assignment -name IGNORE_LCELL_BUFFERS Off
|
||||
set_global_assignment -name MAX7000_IGNORE_LCELL_BUFFERS AUTO
|
||||
set_global_assignment -name IGNORE_SOFT_BUFFERS On
|
||||
set_global_assignment -name MAX7000_IGNORE_SOFT_BUFFERS Off
|
||||
set_global_assignment -name LIMIT_AHDL_INTEGERS_TO_32_BITS Off
|
||||
set_global_assignment -name AUTO_GLOBAL_CLOCK_MAX On
|
||||
set_global_assignment -name AUTO_GLOBAL_OE_MAX On
|
||||
set_global_assignment -name MAX_AUTO_GLOBAL_REGISTER_CONTROLS On
|
||||
set_global_assignment -name AUTO_IMPLEMENT_IN_ROM Off
|
||||
set_global_assignment -name APEX20K_TECHNOLOGY_MAPPER Lut
|
||||
set_global_assignment -name OPTIMIZATION_TECHNIQUE Balanced
|
||||
set_global_assignment -name STRATIXII_OPTIMIZATION_TECHNIQUE Balanced
|
||||
set_global_assignment -name CYCLONE_OPTIMIZATION_TECHNIQUE Balanced
|
||||
set_global_assignment -name CYCLONEII_OPTIMIZATION_TECHNIQUE Balanced
|
||||
set_global_assignment -name STRATIX_OPTIMIZATION_TECHNIQUE Balanced
|
||||
set_global_assignment -name MAXII_OPTIMIZATION_TECHNIQUE Balanced
|
||||
set_global_assignment -name MAX7000_OPTIMIZATION_TECHNIQUE Speed
|
||||
set_global_assignment -name APEX20K_OPTIMIZATION_TECHNIQUE Balanced
|
||||
set_global_assignment -name MERCURY_OPTIMIZATION_TECHNIQUE Area
|
||||
set_global_assignment -name FLEX6K_OPTIMIZATION_TECHNIQUE Area
|
||||
set_global_assignment -name FLEX10K_OPTIMIZATION_TECHNIQUE Area
|
||||
set_global_assignment -name ALLOW_XOR_GATE_USAGE On
|
||||
set_global_assignment -name AUTO_LCELL_INSERTION On
|
||||
set_global_assignment -name CARRY_CHAIN_LENGTH 48
|
||||
set_global_assignment -name FLEX6K_CARRY_CHAIN_LENGTH 32
|
||||
set_global_assignment -name FLEX10K_CARRY_CHAIN_LENGTH 32
|
||||
set_global_assignment -name MERCURY_CARRY_CHAIN_LENGTH 48
|
||||
set_global_assignment -name STRATIX_CARRY_CHAIN_LENGTH 70
|
||||
set_global_assignment -name STRATIXII_CARRY_CHAIN_LENGTH 70
|
||||
set_global_assignment -name CASCADE_CHAIN_LENGTH 2
|
||||
set_global_assignment -name PARALLEL_EXPANDER_CHAIN_LENGTH 16
|
||||
set_global_assignment -name MAX7000_PARALLEL_EXPANDER_CHAIN_LENGTH 4
|
||||
set_global_assignment -name AUTO_CARRY_CHAINS On
|
||||
set_global_assignment -name AUTO_CASCADE_CHAINS On
|
||||
set_global_assignment -name AUTO_PARALLEL_EXPANDERS On
|
||||
set_global_assignment -name AUTO_OPEN_DRAIN_PINS On
|
||||
set_global_assignment -name ADV_NETLIST_OPT_SYNTH_WYSIWYG_REMAP Off
|
||||
set_global_assignment -name AUTO_ROM_RECOGNITION On
|
||||
set_global_assignment -name AUTO_RAM_RECOGNITION On
|
||||
set_global_assignment -name AUTO_DSP_RECOGNITION On
|
||||
set_global_assignment -name AUTO_SHIFT_REGISTER_RECOGNITION Auto
|
||||
set_global_assignment -name ALLOW_SHIFT_REGISTER_MERGING_ACROSS_HIERARCHIES Auto
|
||||
set_global_assignment -name AUTO_CLOCK_ENABLE_RECOGNITION On
|
||||
set_global_assignment -name STRICT_RAM_RECOGNITION Off
|
||||
set_global_assignment -name ALLOW_SYNCH_CTRL_USAGE On
|
||||
set_global_assignment -name FORCE_SYNCH_CLEAR Off
|
||||
set_global_assignment -name AUTO_RAM_BLOCK_BALANCING On
|
||||
set_global_assignment -name AUTO_RAM_TO_LCELL_CONVERSION Off
|
||||
set_global_assignment -name AUTO_RESOURCE_SHARING Off
|
||||
set_global_assignment -name ALLOW_ANY_SHIFT_REGISTER_SIZE_FOR_RECOGNITION Off
|
||||
set_global_assignment -name MAX7000_FANIN_PER_CELL 100
|
||||
set_global_assignment -name USE_LOGICLOCK_CONSTRAINTS_IN_BALANCING On
|
||||
set_global_assignment -name MAX_RAM_BLOCKS_M512 "-1 (Unlimited)"
|
||||
set_global_assignment -name MAX_RAM_BLOCKS_M4K "-1 (Unlimited)"
|
||||
set_global_assignment -name MAX_RAM_BLOCKS_MRAM "-1 (Unlimited)"
|
||||
set_global_assignment -name IGNORE_TRANSLATE_OFF_AND_SYNTHESIS_OFF Off
|
||||
set_global_assignment -name STRATIXGX_BYPASS_REMAPPING_OF_FORCE_SIGNAL_DETECT_SIGNAL_THRESHOLD_SELECT Off
|
||||
set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS On -family "Arria II GZ"
|
||||
set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS On -family "Arria V"
|
||||
set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS On -family "Cyclone 10 LP"
|
||||
set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS On -family "MAX 10"
|
||||
set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS On -family "Cyclone IV GX"
|
||||
set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS On -family "Stratix IV"
|
||||
set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS On -family "Cyclone IV E"
|
||||
set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS On -family "Arria 10"
|
||||
set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS On -family "Stratix V"
|
||||
set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS On -family "Arria V GZ"
|
||||
set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS On -family "Cyclone V"
|
||||
set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS On -family "Arria II GX"
|
||||
set_global_assignment -name REPORT_PARAMETER_SETTINGS On
|
||||
set_global_assignment -name REPORT_SOURCE_ASSIGNMENTS On
|
||||
set_global_assignment -name REPORT_CONNECTIVITY_CHECKS On
|
||||
set_global_assignment -name IGNORE_MAX_FANOUT_ASSIGNMENTS Off
|
||||
set_global_assignment -name SYNCHRONIZATION_REGISTER_CHAIN_LENGTH 3 -family "Arria V"
|
||||
set_global_assignment -name SYNCHRONIZATION_REGISTER_CHAIN_LENGTH 2 -family "Cyclone 10 LP"
|
||||
set_global_assignment -name SYNCHRONIZATION_REGISTER_CHAIN_LENGTH 2 -family "MAX 10"
|
||||
set_global_assignment -name SYNCHRONIZATION_REGISTER_CHAIN_LENGTH 2 -family "Cyclone IV E"
|
||||
set_global_assignment -name SYNCHRONIZATION_REGISTER_CHAIN_LENGTH 3 -family "Stratix IV"
|
||||
set_global_assignment -name SYNCHRONIZATION_REGISTER_CHAIN_LENGTH 3 -family "Arria 10"
|
||||
set_global_assignment -name SYNCHRONIZATION_REGISTER_CHAIN_LENGTH 2 -family "MAX V"
|
||||
set_global_assignment -name SYNCHRONIZATION_REGISTER_CHAIN_LENGTH 3 -family "Stratix V"
|
||||
set_global_assignment -name SYNCHRONIZATION_REGISTER_CHAIN_LENGTH 2 -family "MAX II"
|
||||
set_global_assignment -name SYNCHRONIZATION_REGISTER_CHAIN_LENGTH 3 -family "Arria V GZ"
|
||||
set_global_assignment -name SYNCHRONIZATION_REGISTER_CHAIN_LENGTH 3 -family "Arria II GX"
|
||||
set_global_assignment -name SYNCHRONIZATION_REGISTER_CHAIN_LENGTH 3 -family "Arria II GZ"
|
||||
set_global_assignment -name SYNCHRONIZATION_REGISTER_CHAIN_LENGTH 2 -family "Cyclone IV GX"
|
||||
set_global_assignment -name SYNCHRONIZATION_REGISTER_CHAIN_LENGTH 3 -family "Cyclone V"
|
||||
set_global_assignment -name OPTIMIZE_POWER_DURING_SYNTHESIS "Normal compilation"
|
||||
set_global_assignment -name HDL_MESSAGE_LEVEL Level2
|
||||
set_global_assignment -name USE_HIGH_SPEED_ADDER Auto
|
||||
set_global_assignment -name NUMBER_OF_PROTECTED_REGISTERS_REPORTED 100
|
||||
set_global_assignment -name NUMBER_OF_REMOVED_REGISTERS_REPORTED 5000
|
||||
set_global_assignment -name NUMBER_OF_SYNTHESIS_MIGRATION_ROWS 5000
|
||||
set_global_assignment -name SYNTHESIS_S10_MIGRATION_CHECKS Off
|
||||
set_global_assignment -name NUMBER_OF_SWEPT_NODES_REPORTED 5000
|
||||
set_global_assignment -name NUMBER_OF_INVERTED_REGISTERS_REPORTED 100
|
||||
set_global_assignment -name SYNTH_CLOCK_MUX_PROTECTION On
|
||||
set_global_assignment -name SYNTH_GATED_CLOCK_CONVERSION Off
|
||||
set_global_assignment -name BLOCK_DESIGN_NAMING Auto
|
||||
set_global_assignment -name SYNTH_PROTECT_SDC_CONSTRAINT Off
|
||||
set_global_assignment -name SYNTHESIS_EFFORT Auto
|
||||
set_global_assignment -name SHIFT_REGISTER_RECOGNITION_ACLR_SIGNAL On
|
||||
set_global_assignment -name PRE_MAPPING_RESYNTHESIS Off
|
||||
set_global_assignment -name SYNTH_MESSAGE_LEVEL Medium
|
||||
set_global_assignment -name DISABLE_REGISTER_MERGING_ACROSS_HIERARCHIES Auto
|
||||
set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Arria II GZ"
|
||||
set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Arria V"
|
||||
set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Cyclone 10 LP"
|
||||
set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "MAX 10"
|
||||
set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Cyclone IV GX"
|
||||
set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Stratix IV"
|
||||
set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Cyclone IV E"
|
||||
set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Arria 10"
|
||||
set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Stratix V"
|
||||
set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Arria V GZ"
|
||||
set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Cyclone V"
|
||||
set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Arria II GX"
|
||||
set_global_assignment -name MAX_LABS "-1 (Unlimited)"
|
||||
set_global_assignment -name RBCGEN_CRITICAL_WARNING_TO_ERROR On
|
||||
set_global_assignment -name MAX_NUMBER_OF_REGISTERS_FROM_UNINFERRED_RAMS "-1 (Unlimited)"
|
||||
set_global_assignment -name AUTO_PARALLEL_SYNTHESIS On
|
||||
set_global_assignment -name PRPOF_ID Off
|
||||
set_global_assignment -name DISABLE_DSP_NEGATE_INFERENCING Off
|
||||
set_global_assignment -name REPORT_PARAMETER_SETTINGS_PRO On
|
||||
set_global_assignment -name REPORT_SOURCE_ASSIGNMENTS_PRO On
|
||||
set_global_assignment -name ENABLE_STATE_MACHINE_INFERENCE Off
|
||||
set_global_assignment -name FLEX10K_ENABLE_LOCK_OUTPUT Off
|
||||
set_global_assignment -name AUTO_MERGE_PLLS On
|
||||
set_global_assignment -name IGNORE_MODE_FOR_MERGE Off
|
||||
set_global_assignment -name TXPMA_SLEW_RATE Low
|
||||
set_global_assignment -name ADCE_ENABLED Auto
|
||||
set_global_assignment -name ROUTER_TIMING_OPTIMIZATION_LEVEL Normal
|
||||
set_global_assignment -name ROUTER_CLOCKING_TOPOLOGY_ANALYSIS Off
|
||||
set_global_assignment -name PLACEMENT_EFFORT_MULTIPLIER 1.0
|
||||
set_global_assignment -name ROUTER_EFFORT_MULTIPLIER 1.0
|
||||
set_global_assignment -name FIT_ATTEMPTS_TO_SKIP 0.0
|
||||
set_global_assignment -name PHYSICAL_SYNTHESIS Off
|
||||
set_global_assignment -name ECO_ALLOW_ROUTING_CHANGES Off
|
||||
set_global_assignment -name DEVICE AUTO
|
||||
set_global_assignment -name BASE_PIN_OUT_FILE_ON_SAMEFRAME_DEVICE Off
|
||||
set_global_assignment -name ENABLE_JTAG_BST_SUPPORT Off
|
||||
set_global_assignment -name MAX7000_ENABLE_JTAG_BST_SUPPORT On
|
||||
set_global_assignment -name ENABLE_NCEO_OUTPUT Off
|
||||
set_global_assignment -name RESERVE_NCEO_AFTER_CONFIGURATION "Use as regular IO"
|
||||
set_global_assignment -name CYCLONEII_RESERVE_NCEO_AFTER_CONFIGURATION "Use as programming pin"
|
||||
set_global_assignment -name STRATIXIII_UPDATE_MODE Standard
|
||||
set_global_assignment -name STRATIX_UPDATE_MODE Standard
|
||||
set_global_assignment -name INTERNAL_FLASH_UPDATE_MODE "Single Image"
|
||||
set_global_assignment -name CVP_MODE Off
|
||||
set_global_assignment -name STRATIXV_CONFIGURATION_SCHEME "Passive Serial" -family "Arria V"
|
||||
set_global_assignment -name STRATIXV_CONFIGURATION_SCHEME "Passive Serial" -family "Arria 10"
|
||||
set_global_assignment -name STRATIXV_CONFIGURATION_SCHEME "Passive Serial" -family "Stratix V"
|
||||
set_global_assignment -name STRATIXV_CONFIGURATION_SCHEME "Passive Serial" -family "Arria V GZ"
|
||||
set_global_assignment -name STRATIXV_CONFIGURATION_SCHEME "Passive Serial" -family "Cyclone V"
|
||||
set_global_assignment -name VID_OPERATION_MODE "PMBus Slave"
|
||||
set_global_assignment -name USE_CONF_DONE AUTO
|
||||
set_global_assignment -name USE_PWRMGT_SCL AUTO
|
||||
set_global_assignment -name USE_PWRMGT_SDA AUTO
|
||||
set_global_assignment -name USE_PWRMGT_ALERT AUTO
|
||||
set_global_assignment -name USE_INIT_DONE AUTO
|
||||
set_global_assignment -name USE_CVP_CONFDONE AUTO
|
||||
set_global_assignment -name USE_SEU_ERROR AUTO
|
||||
set_global_assignment -name RESERVE_AVST_CLK_AFTER_CONFIGURATION "Use as regular IO"
|
||||
set_global_assignment -name RESERVE_AVST_VALID_AFTER_CONFIGURATION "Use as regular IO"
|
||||
set_global_assignment -name RESERVE_AVST_DATA15_THROUGH_DATA0_AFTER_CONFIGURATION "Use as regular IO"
|
||||
set_global_assignment -name RESERVE_AVST_DATA31_THROUGH_DATA16_AFTER_CONFIGURATION "Use as regular IO"
|
||||
set_global_assignment -name STRATIXIII_CONFIGURATION_SCHEME "Passive Serial"
|
||||
set_global_assignment -name MAX10FPGA_CONFIGURATION_SCHEME "Internal Configuration"
|
||||
set_global_assignment -name CYCLONEIII_CONFIGURATION_SCHEME "Active Serial"
|
||||
set_global_assignment -name STRATIXII_CONFIGURATION_SCHEME "Passive Serial"
|
||||
set_global_assignment -name CYCLONEII_CONFIGURATION_SCHEME "Active Serial"
|
||||
set_global_assignment -name APEX20K_CONFIGURATION_SCHEME "Passive Serial"
|
||||
set_global_assignment -name STRATIX_CONFIGURATION_SCHEME "Passive Serial"
|
||||
set_global_assignment -name CYCLONE_CONFIGURATION_SCHEME "Active Serial"
|
||||
set_global_assignment -name MERCURY_CONFIGURATION_SCHEME "Passive Serial"
|
||||
set_global_assignment -name FLEX6K_CONFIGURATION_SCHEME "Passive Serial"
|
||||
set_global_assignment -name FLEX10K_CONFIGURATION_SCHEME "Passive Serial"
|
||||
set_global_assignment -name APEXII_CONFIGURATION_SCHEME "Passive Serial"
|
||||
set_global_assignment -name USER_START_UP_CLOCK Off
|
||||
set_global_assignment -name ENABLE_UNUSED_RX_CLOCK_WORKAROUND Off
|
||||
set_global_assignment -name PRESERVE_UNUSED_XCVR_CHANNEL Off
|
||||
set_global_assignment -name IGNORE_HSSI_COLUMN_POWER_WHEN_PRESERVING_UNUSED_XCVR_CHANNELS On
|
||||
set_global_assignment -name AUTO_RESERVE_CLKUSR_FOR_CALIBRATION On
|
||||
set_global_assignment -name DEVICE_INITIALIZATION_CLOCK INIT_INTOSC
|
||||
set_global_assignment -name ENABLE_VREFA_PIN Off
|
||||
set_global_assignment -name ENABLE_VREFB_PIN Off
|
||||
set_global_assignment -name ALWAYS_ENABLE_INPUT_BUFFERS Off
|
||||
set_global_assignment -name ENABLE_ASMI_FOR_FLASH_LOADER Off
|
||||
set_global_assignment -name ENABLE_DEVICE_WIDE_RESET Off
|
||||
set_global_assignment -name ENABLE_DEVICE_WIDE_OE Off
|
||||
set_global_assignment -name RESERVE_ALL_UNUSED_PINS "As output driving ground"
|
||||
set_global_assignment -name ENABLE_INIT_DONE_OUTPUT Off
|
||||
set_global_assignment -name INIT_DONE_OPEN_DRAIN On
|
||||
set_global_assignment -name RESERVE_NWS_NRS_NCS_CS_AFTER_CONFIGURATION "Use as regular IO"
|
||||
set_global_assignment -name RESERVE_RDYNBUSY_AFTER_CONFIGURATION "Use as regular IO"
|
||||
set_global_assignment -name RESERVE_DATA31_THROUGH_DATA16_AFTER_CONFIGURATION "Use as regular IO"
|
||||
set_global_assignment -name RESERVE_DATA15_THROUGH_DATA8_AFTER_CONFIGURATION "Use as regular IO"
|
||||
set_global_assignment -name RESERVE_DATA7_THROUGH_DATA1_AFTER_CONFIGURATION "Use as regular IO"
|
||||
set_global_assignment -name RESERVE_DATA0_AFTER_CONFIGURATION "As input tri-stated"
|
||||
set_global_assignment -name RESERVE_DATA1_AFTER_CONFIGURATION "As input tri-stated"
|
||||
set_global_assignment -name RESERVE_DATA7_THROUGH_DATA2_AFTER_CONFIGURATION "Use as regular IO"
|
||||
set_global_assignment -name RESERVE_DATA7_THROUGH_DATA5_AFTER_CONFIGURATION "Use as regular IO"
|
||||
set_global_assignment -name RESERVE_FLASH_NCE_AFTER_CONFIGURATION "As input tri-stated"
|
||||
set_global_assignment -name RESERVE_OTHER_AP_PINS_AFTER_CONFIGURATION "Use as regular IO"
|
||||
set_global_assignment -name RESERVE_DCLK_AFTER_CONFIGURATION "Use as programming pin"
|
||||
set_global_assignment -name ENABLE_CONFIGURATION_PINS On
|
||||
set_global_assignment -name ENABLE_JTAG_PIN_SHARING Off
|
||||
set_global_assignment -name ENABLE_NCE_PIN Off
|
||||
set_global_assignment -name ENABLE_BOOT_SEL_PIN On
|
||||
set_global_assignment -name CRC_ERROR_CHECKING Off
|
||||
set_global_assignment -name INTERNAL_SCRUBBING Off
|
||||
set_global_assignment -name PR_ERROR_OPEN_DRAIN On
|
||||
set_global_assignment -name PR_READY_OPEN_DRAIN On
|
||||
set_global_assignment -name ENABLE_CVP_CONFDONE Off
|
||||
set_global_assignment -name CVP_CONFDONE_OPEN_DRAIN On
|
||||
set_global_assignment -name ENABLE_NCONFIG_FROM_CORE On
|
||||
set_global_assignment -name OPTIMIZE_HOLD_TIMING "All Paths" -family "Arria II GZ"
|
||||
set_global_assignment -name OPTIMIZE_HOLD_TIMING "All Paths" -family "Arria V"
|
||||
set_global_assignment -name OPTIMIZE_HOLD_TIMING "All Paths" -family "Cyclone 10 LP"
|
||||
set_global_assignment -name OPTIMIZE_HOLD_TIMING "All Paths" -family "MAX 10"
|
||||
set_global_assignment -name OPTIMIZE_HOLD_TIMING "All Paths" -family "Cyclone IV GX"
|
||||
set_global_assignment -name OPTIMIZE_HOLD_TIMING "All Paths" -family "Stratix IV"
|
||||
set_global_assignment -name OPTIMIZE_HOLD_TIMING "All Paths" -family "Cyclone IV E"
|
||||
set_global_assignment -name OPTIMIZE_HOLD_TIMING "All Paths" -family "Arria 10"
|
||||
set_global_assignment -name OPTIMIZE_HOLD_TIMING "IO Paths and Minimum TPD Paths" -family "MAX V"
|
||||
set_global_assignment -name OPTIMIZE_HOLD_TIMING "All Paths" -family "Stratix V"
|
||||
set_global_assignment -name OPTIMIZE_HOLD_TIMING "IO Paths and Minimum TPD Paths" -family "MAX II"
|
||||
set_global_assignment -name OPTIMIZE_HOLD_TIMING "All Paths" -family "Arria V GZ"
|
||||
set_global_assignment -name OPTIMIZE_HOLD_TIMING "All Paths" -family "Cyclone V"
|
||||
set_global_assignment -name OPTIMIZE_HOLD_TIMING "All Paths" -family "Arria II GX"
|
||||
set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING On -family "Arria V"
|
||||
set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING On -family "Cyclone 10 LP"
|
||||
set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING On -family "MAX 10"
|
||||
set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING On -family "Cyclone IV E"
|
||||
set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING On -family "Stratix IV"
|
||||
set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING On -family "Arria 10"
|
||||
set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING Off -family "MAX V"
|
||||
set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING On -family "Stratix V"
|
||||
set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING On -family "Arria V GZ"
|
||||
set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING Off -family "MAX II"
|
||||
set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING On -family "Arria II GX"
|
||||
set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING On -family "Arria II GZ"
|
||||
set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING On -family "Cyclone IV GX"
|
||||
set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING On -family "Cyclone V"
|
||||
set_global_assignment -name BLOCK_RAM_TO_MLAB_CELL_CONVERSION On
|
||||
set_global_assignment -name BLOCK_RAM_AND_MLAB_EQUIVALENT_POWER_UP_CONDITIONS Auto
|
||||
set_global_assignment -name BLOCK_RAM_AND_MLAB_EQUIVALENT_PAUSED_READ_CAPABILITIES Care
|
||||
set_global_assignment -name PROGRAMMABLE_POWER_TECHNOLOGY_SETTING Automatic -family "Stratix IV"
|
||||
set_global_assignment -name PROGRAMMABLE_POWER_TECHNOLOGY_SETTING Automatic -family "Arria 10"
|
||||
set_global_assignment -name PROGRAMMABLE_POWER_TECHNOLOGY_SETTING Automatic -family "Stratix V"
|
||||
set_global_assignment -name PROGRAMMABLE_POWER_TECHNOLOGY_SETTING Automatic -family "Arria V GZ"
|
||||
set_global_assignment -name PROGRAMMABLE_POWER_MAXIMUM_HIGH_SPEED_FRACTION_OF_USED_LAB_TILES 1.0
|
||||
set_global_assignment -name GUARANTEE_MIN_DELAY_CORNER_IO_ZERO_HOLD_TIME On
|
||||
set_global_assignment -name OPTIMIZE_POWER_DURING_FITTING "Normal compilation"
|
||||
set_global_assignment -name OPTIMIZE_SSN Off
|
||||
set_global_assignment -name OPTIMIZE_TIMING "Normal compilation"
|
||||
set_global_assignment -name ECO_OPTIMIZE_TIMING Off
|
||||
set_global_assignment -name ECO_REGENERATE_REPORT Off
|
||||
set_global_assignment -name OPTIMIZE_IOC_REGISTER_PLACEMENT_FOR_TIMING Normal
|
||||
set_global_assignment -name FIT_ONLY_ONE_ATTEMPT Off
|
||||
set_global_assignment -name FINAL_PLACEMENT_OPTIMIZATION Automatically
|
||||
set_global_assignment -name FITTER_AGGRESSIVE_ROUTABILITY_OPTIMIZATION Automatically
|
||||
set_global_assignment -name SEED 1
|
||||
set_global_assignment -name PERIPHERY_TO_CORE_PLACEMENT_AND_ROUTING_OPTIMIZATION OFF
|
||||
set_global_assignment -name RESERVE_ROUTING_OUTPUT_FLEXIBILITY Off
|
||||
set_global_assignment -name SLOW_SLEW_RATE Off
|
||||
set_global_assignment -name PCI_IO Off
|
||||
set_global_assignment -name TURBO_BIT On
|
||||
set_global_assignment -name WEAK_PULL_UP_RESISTOR Off
|
||||
set_global_assignment -name ENABLE_BUS_HOLD_CIRCUITRY Off
|
||||
set_global_assignment -name AUTO_GLOBAL_MEMORY_CONTROLS Off
|
||||
set_global_assignment -name MIGRATION_CONSTRAIN_CORE_RESOURCES On
|
||||
set_global_assignment -name QII_AUTO_PACKED_REGISTERS Auto
|
||||
set_global_assignment -name AUTO_PACKED_REGISTERS_MAX Auto
|
||||
set_global_assignment -name NORMAL_LCELL_INSERT On
|
||||
set_global_assignment -name CARRY_OUT_PINS_LCELL_INSERT On
|
||||
set_global_assignment -name AUTO_DELAY_CHAINS On -family "Arria V"
|
||||
set_global_assignment -name AUTO_DELAY_CHAINS On -family "Cyclone 10 LP"
|
||||
set_global_assignment -name AUTO_DELAY_CHAINS On -family "MAX 10"
|
||||
set_global_assignment -name AUTO_DELAY_CHAINS On -family "Stratix IV"
|
||||
set_global_assignment -name AUTO_DELAY_CHAINS On -family "Cyclone IV E"
|
||||
set_global_assignment -name AUTO_DELAY_CHAINS On -family "Arria 10"
|
||||
set_global_assignment -name AUTO_DELAY_CHAINS On -family "MAX V"
|
||||
set_global_assignment -name AUTO_DELAY_CHAINS On -family "Stratix V"
|
||||
set_global_assignment -name AUTO_DELAY_CHAINS On -family "MAX II"
|
||||
set_global_assignment -name AUTO_DELAY_CHAINS On -family "Arria V GZ"
|
||||
set_global_assignment -name AUTO_DELAY_CHAINS On -family "Arria II GX"
|
||||
set_global_assignment -name AUTO_DELAY_CHAINS On -family "Arria II GZ"
|
||||
set_global_assignment -name AUTO_DELAY_CHAINS On -family "Cyclone IV GX"
|
||||
set_global_assignment -name AUTO_DELAY_CHAINS On -family "Cyclone V"
|
||||
set_global_assignment -name AUTO_DELAY_CHAINS_FOR_HIGH_FANOUT_INPUT_PINS OFF
|
||||
set_global_assignment -name XSTL_INPUT_ALLOW_SE_BUFFER Off
|
||||
set_global_assignment -name TREAT_BIDIR_AS_OUTPUT Off
|
||||
set_global_assignment -name AUTO_TURBO_BIT ON
|
||||
set_global_assignment -name PHYSICAL_SYNTHESIS_COMBO_LOGIC_FOR_AREA Off
|
||||
set_global_assignment -name PHYSICAL_SYNTHESIS_COMBO_LOGIC Off
|
||||
set_global_assignment -name PHYSICAL_SYNTHESIS_LOG_FILE Off
|
||||
set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_DUPLICATION Off
|
||||
set_global_assignment -name PHYSICAL_SYNTHESIS_MAP_LOGIC_TO_MEMORY_FOR_AREA Off
|
||||
set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_RETIMING Off
|
||||
set_global_assignment -name PHYSICAL_SYNTHESIS_ASYNCHRONOUS_SIGNAL_PIPELINING Off
|
||||
set_global_assignment -name IO_PLACEMENT_OPTIMIZATION On
|
||||
set_global_assignment -name ALLOW_LVTTL_LVCMOS_INPUT_LEVELS_TO_OVERDRIVE_INPUT_BUFFER Off
|
||||
set_global_assignment -name OVERRIDE_DEFAULT_ELECTROMIGRATION_PARAMETERS Off
|
||||
set_global_assignment -name FITTER_EFFORT "Auto Fit"
|
||||
set_global_assignment -name FITTER_AUTO_EFFORT_DESIRED_SLACK_MARGIN 0ns
|
||||
set_global_assignment -name PHYSICAL_SYNTHESIS_EFFORT Normal
|
||||
set_global_assignment -name ROUTER_LCELL_INSERTION_AND_LOGIC_DUPLICATION Auto
|
||||
set_global_assignment -name ROUTER_REGISTER_DUPLICATION Auto
|
||||
set_global_assignment -name STRATIXGX_ALLOW_CLOCK_FANOUT_WITH_ANALOG_RESET Off
|
||||
set_global_assignment -name AUTO_GLOBAL_CLOCK On
|
||||
set_global_assignment -name AUTO_GLOBAL_OE On
|
||||
set_global_assignment -name AUTO_GLOBAL_REGISTER_CONTROLS On
|
||||
set_global_assignment -name FITTER_EARLY_TIMING_ESTIMATE_MODE Realistic
|
||||
set_global_assignment -name STRATIXGX_ALLOW_GIGE_UNDER_FULL_DATARATE_RANGE Off
|
||||
set_global_assignment -name STRATIXGX_ALLOW_RX_CORECLK_FROM_NON_RX_CLKOUT_SOURCE_IN_DOUBLE_DATA_WIDTH_MODE Off
|
||||
set_global_assignment -name STRATIXGX_ALLOW_GIGE_IN_DOUBLE_DATA_WIDTH_MODE Off
|
||||
set_global_assignment -name STRATIXGX_ALLOW_PARALLEL_LOOPBACK_IN_DOUBLE_DATA_WIDTH_MODE Off
|
||||
set_global_assignment -name STRATIXGX_ALLOW_XAUI_IN_SINGLE_DATA_WIDTH_MODE Off
|
||||
set_global_assignment -name STRATIXGX_ALLOW_XAUI_WITH_CORECLK_SELECTED_AT_RATE_MATCHER Off
|
||||
set_global_assignment -name STRATIXGX_ALLOW_XAUI_WITH_RX_CORECLK_FROM_NON_TXPLL_SOURCE Off
|
||||
set_global_assignment -name STRATIXGX_ALLOW_GIGE_WITH_CORECLK_SELECTED_AT_RATE_MATCHER Off
|
||||
set_global_assignment -name STRATIXGX_ALLOW_GIGE_WITHOUT_8B10B Off
|
||||
set_global_assignment -name STRATIXGX_ALLOW_GIGE_WITH_RX_CORECLK_FROM_NON_TXPLL_SOURCE Off
|
||||
set_global_assignment -name STRATIXGX_ALLOW_POST8B10B_LOOPBACK Off
|
||||
set_global_assignment -name STRATIXGX_ALLOW_REVERSE_PARALLEL_LOOPBACK Off
|
||||
set_global_assignment -name STRATIXGX_ALLOW_USE_OF_GXB_COUPLED_IOS Off
|
||||
set_global_assignment -name GENERATE_GXB_RECONFIG_MIF Off
|
||||
set_global_assignment -name GENERATE_GXB_RECONFIG_MIF_WITH_PLL Off
|
||||
set_global_assignment -name RESERVE_ALL_UNUSED_PINS_WEAK_PULLUP "As input tri-stated with weak pull-up"
|
||||
set_global_assignment -name ENABLE_HOLD_BACK_OFF On
|
||||
set_global_assignment -name CONFIGURATION_VCCIO_LEVEL Auto
|
||||
set_global_assignment -name FORCE_CONFIGURATION_VCCIO Off
|
||||
set_global_assignment -name SYNCHRONIZER_IDENTIFICATION Auto
|
||||
set_global_assignment -name ENABLE_BENEFICIAL_SKEW_OPTIMIZATION On
|
||||
set_global_assignment -name OPTIMIZE_FOR_METASTABILITY On
|
||||
set_global_assignment -name CRC_ERROR_OPEN_DRAIN On -family "Arria V"
|
||||
set_global_assignment -name CRC_ERROR_OPEN_DRAIN Off -family "Cyclone 10 LP"
|
||||
set_global_assignment -name CRC_ERROR_OPEN_DRAIN Off -family "MAX 10"
|
||||
set_global_assignment -name CRC_ERROR_OPEN_DRAIN Off -family "Cyclone IV E"
|
||||
set_global_assignment -name CRC_ERROR_OPEN_DRAIN On -family "Arria 10"
|
||||
set_global_assignment -name CRC_ERROR_OPEN_DRAIN On -family "Stratix V"
|
||||
set_global_assignment -name CRC_ERROR_OPEN_DRAIN On -family "Arria V GZ"
|
||||
set_global_assignment -name CRC_ERROR_OPEN_DRAIN On -family "Cyclone V"
|
||||
set_global_assignment -name MAX_GLOBAL_CLOCKS_ALLOWED "-1 (Unlimited)"
|
||||
set_global_assignment -name MAX_REGIONAL_CLOCKS_ALLOWED "-1 (Unlimited)"
|
||||
set_global_assignment -name MAX_PERIPHERY_CLOCKS_ALLOWED "-1 (Unlimited)"
|
||||
set_global_assignment -name MAX_CLOCKS_ALLOWED "-1 (Unlimited)"
|
||||
set_global_assignment -name ACTIVE_SERIAL_CLOCK FREQ_100MHz -family "Arria 10"
|
||||
set_global_assignment -name ACTIVE_SERIAL_CLOCK FREQ_100MHz -family "Arria V"
|
||||
set_global_assignment -name ACTIVE_SERIAL_CLOCK FREQ_100MHz -family "Stratix V"
|
||||
set_global_assignment -name ACTIVE_SERIAL_CLOCK FREQ_40MHz -family "Cyclone IV GX"
|
||||
set_global_assignment -name ACTIVE_SERIAL_CLOCK FREQ_100MHz -family "Arria V GZ"
|
||||
set_global_assignment -name ACTIVE_SERIAL_CLOCK FREQ_100MHz -family "Cyclone V"
|
||||
set_global_assignment -name ACTIVE_SERIAL_CLOCK FREQ_40MHz -family "Arria II GX"
|
||||
set_global_assignment -name M144K_BLOCK_READ_CLOCK_DUTY_CYCLE_DEPENDENCY Off
|
||||
set_global_assignment -name STRATIXIII_MRAM_COMPATIBILITY On
|
||||
set_global_assignment -name FORCE_FITTER_TO_AVOID_PERIPHERY_PLACEMENT_WARNINGS Off
|
||||
set_global_assignment -name AUTO_C3_M9K_BIT_SKIP Off
|
||||
set_global_assignment -name PR_DONE_OPEN_DRAIN On
|
||||
set_global_assignment -name NCEO_OPEN_DRAIN On
|
||||
set_global_assignment -name ENABLE_CRC_ERROR_PIN Off
|
||||
set_global_assignment -name ENABLE_PR_PINS Off
|
||||
set_global_assignment -name RESERVE_PR_PINS Off
|
||||
set_global_assignment -name CONVERT_PR_WARNINGS_TO_ERRORS Off
|
||||
set_global_assignment -name PR_PINS_OPEN_DRAIN Off
|
||||
set_global_assignment -name CLAMPING_DIODE Off
|
||||
set_global_assignment -name TRI_STATE_SPI_PINS Off
|
||||
set_global_assignment -name UNUSED_TSD_PINS_GND Off
|
||||
set_global_assignment -name IMPLEMENT_MLAB_IN_16_BIT_DEEP_MODE Off
|
||||
set_global_assignment -name FORM_DDR_CLUSTERING_CLIQUE Off
|
||||
set_global_assignment -name ALM_REGISTER_PACKING_EFFORT Medium
|
||||
set_global_assignment -name ADVANCED_PHYSICAL_OPTIMIZATION On -family "Arria V"
|
||||
set_global_assignment -name ADVANCED_PHYSICAL_OPTIMIZATION Off -family "Stratix IV"
|
||||
set_global_assignment -name ADVANCED_PHYSICAL_OPTIMIZATION On -family "Arria 10"
|
||||
set_global_assignment -name ADVANCED_PHYSICAL_OPTIMIZATION On -family "Stratix V"
|
||||
set_global_assignment -name ADVANCED_PHYSICAL_OPTIMIZATION On -family "Arria V GZ"
|
||||
set_global_assignment -name ADVANCED_PHYSICAL_OPTIMIZATION On -family "Cyclone V"
|
||||
set_global_assignment -name RELATIVE_NEUTRON_FLUX 1.0
|
||||
set_global_assignment -name SEU_FIT_REPORT Off
|
||||
set_global_assignment -name HYPER_RETIMER Off -family "Arria 10"
|
||||
set_global_assignment -name HYPER_RETIMER_FAST_FORWARD_ADD_PIPELINING_MAX "-1"
|
||||
set_global_assignment -name HYPER_RETIMER_FAST_FORWARD_ASYNCH_CLEAR Auto
|
||||
set_global_assignment -name HYPER_RETIMER_FAST_FORWARD_USER_PRESERVE_RESTRICTION Auto
|
||||
set_global_assignment -name HYPER_RETIMER_FAST_FORWARD_DSP_BLOCKS On
|
||||
set_global_assignment -name HYPER_RETIMER_FAST_FORWARD_RAM_BLOCKS On
|
||||
set_global_assignment -name EDA_SIMULATION_TOOL "<None>"
|
||||
set_global_assignment -name EDA_TIMING_ANALYSIS_TOOL "<None>"
|
||||
set_global_assignment -name EDA_BOARD_DESIGN_TIMING_TOOL "<None>"
|
||||
set_global_assignment -name EDA_BOARD_DESIGN_SYMBOL_TOOL "<None>"
|
||||
set_global_assignment -name EDA_BOARD_DESIGN_SIGNAL_INTEGRITY_TOOL "<None>"
|
||||
set_global_assignment -name EDA_BOARD_DESIGN_BOUNDARY_SCAN_TOOL "<None>"
|
||||
set_global_assignment -name EDA_BOARD_DESIGN_TOOL "<None>"
|
||||
set_global_assignment -name EDA_FORMAL_VERIFICATION_TOOL "<None>"
|
||||
set_global_assignment -name EDA_RESYNTHESIS_TOOL "<None>"
|
||||
set_global_assignment -name ON_CHIP_BITSTREAM_DECOMPRESSION On
|
||||
set_global_assignment -name COMPRESSION_MODE Off
|
||||
set_global_assignment -name CLOCK_SOURCE Internal
|
||||
set_global_assignment -name CONFIGURATION_CLOCK_FREQUENCY "10 MHz"
|
||||
set_global_assignment -name CONFIGURATION_CLOCK_DIVISOR 1
|
||||
set_global_assignment -name ENABLE_LOW_VOLTAGE_MODE_ON_CONFIG_DEVICE On
|
||||
set_global_assignment -name FLEX6K_ENABLE_LOW_VOLTAGE_MODE_ON_CONFIG_DEVICE Off
|
||||
set_global_assignment -name FLEX10K_ENABLE_LOW_VOLTAGE_MODE_ON_CONFIG_DEVICE On
|
||||
set_global_assignment -name MAX7000S_JTAG_USER_CODE FFFF
|
||||
set_global_assignment -name STRATIX_JTAG_USER_CODE FFFFFFFF
|
||||
set_global_assignment -name APEX20K_JTAG_USER_CODE FFFFFFFF
|
||||
set_global_assignment -name MERCURY_JTAG_USER_CODE FFFFFFFF
|
||||
set_global_assignment -name FLEX10K_JTAG_USER_CODE 7F
|
||||
set_global_assignment -name MAX7000_JTAG_USER_CODE FFFFFFFF
|
||||
set_global_assignment -name MAX7000_USE_CHECKSUM_AS_USERCODE Off
|
||||
set_global_assignment -name USE_CHECKSUM_AS_USERCODE On
|
||||
set_global_assignment -name SECURITY_BIT Off
|
||||
set_global_assignment -name USE_CONFIGURATION_DEVICE Off -family "Cyclone 10 LP"
|
||||
set_global_assignment -name USE_CONFIGURATION_DEVICE On -family "MAX 10"
|
||||
set_global_assignment -name USE_CONFIGURATION_DEVICE Off -family "Cyclone IV E"
|
||||
set_global_assignment -name USE_CONFIGURATION_DEVICE Off -family "Stratix IV"
|
||||
set_global_assignment -name USE_CONFIGURATION_DEVICE On -family "MAX V"
|
||||
set_global_assignment -name USE_CONFIGURATION_DEVICE On -family "MAX II"
|
||||
set_global_assignment -name USE_CONFIGURATION_DEVICE Off -family "Arria II GX"
|
||||
set_global_assignment -name USE_CONFIGURATION_DEVICE Off -family "Arria II GZ"
|
||||
set_global_assignment -name USE_CONFIGURATION_DEVICE Off -family "Cyclone IV GX"
|
||||
set_global_assignment -name CYCLONEIII_CONFIGURATION_DEVICE Auto
|
||||
set_global_assignment -name STRATIXII_CONFIGURATION_DEVICE Auto
|
||||
set_global_assignment -name PWRMGT_SLAVE_DEVICE_TYPE "PV3102 or EM1130"
|
||||
set_global_assignment -name PWRMGT_SLAVE_DEVICE0_ADDRESS 0000000
|
||||
set_global_assignment -name PWRMGT_SLAVE_DEVICE1_ADDRESS 0000000
|
||||
set_global_assignment -name PWRMGT_SLAVE_DEVICE2_ADDRESS 0000000
|
||||
set_global_assignment -name PWRMGT_SLAVE_DEVICE3_ADDRESS 0000000
|
||||
set_global_assignment -name PWRMGT_SLAVE_DEVICE4_ADDRESS 0000000
|
||||
set_global_assignment -name PWRMGT_SLAVE_DEVICE5_ADDRESS 0000000
|
||||
set_global_assignment -name PWRMGT_SLAVE_DEVICE6_ADDRESS 0000000
|
||||
set_global_assignment -name PWRMGT_SLAVE_DEVICE7_ADDRESS 0000000
|
||||
set_global_assignment -name PWRMGT_VOLTAGE_OUTPUT_FORMAT "Auto discovery"
|
||||
set_global_assignment -name PWRMGT_DIRECT_FORMAT_COEFFICIENT_M 0
|
||||
set_global_assignment -name PWRMGT_DIRECT_FORMAT_COEFFICIENT_B 0
|
||||
set_global_assignment -name PWRMGT_DIRECT_FORMAT_COEFFICIENT_R 0
|
||||
set_global_assignment -name APEX20K_CONFIGURATION_DEVICE Auto
|
||||
set_global_assignment -name MERCURY_CONFIGURATION_DEVICE Auto
|
||||
set_global_assignment -name FLEX6K_CONFIGURATION_DEVICE Auto
|
||||
set_global_assignment -name FLEX10K_CONFIGURATION_DEVICE Auto
|
||||
set_global_assignment -name CYCLONE_CONFIGURATION_DEVICE Auto
|
||||
set_global_assignment -name STRATIX_CONFIGURATION_DEVICE Auto
|
||||
set_global_assignment -name APEX20K_CONFIG_DEVICE_JTAG_USER_CODE FFFFFFFF
|
||||
set_global_assignment -name STRATIX_CONFIG_DEVICE_JTAG_USER_CODE FFFFFFFF
|
||||
set_global_assignment -name MERCURY_CONFIG_DEVICE_JTAG_USER_CODE FFFFFFFF
|
||||
set_global_assignment -name FLEX10K_CONFIG_DEVICE_JTAG_USER_CODE FFFFFFFF
|
||||
set_global_assignment -name EPROM_USE_CHECKSUM_AS_USERCODE Off
|
||||
set_global_assignment -name AUTO_INCREMENT_CONFIG_DEVICE_JTAG_USER_CODE On
|
||||
set_global_assignment -name DISABLE_NCS_AND_OE_PULLUPS_ON_CONFIG_DEVICE Off
|
||||
set_global_assignment -name GENERATE_TTF_FILE Off
|
||||
set_global_assignment -name GENERATE_RBF_FILE Off
|
||||
set_global_assignment -name GENERATE_HEX_FILE Off
|
||||
set_global_assignment -name HEXOUT_FILE_START_ADDRESS 0
|
||||
set_global_assignment -name HEXOUT_FILE_COUNT_DIRECTION Up
|
||||
set_global_assignment -name RESERVE_ALL_UNUSED_PINS_NO_OUTPUT_GND "As output driving an unspecified signal"
|
||||
set_global_assignment -name RELEASE_CLEARS_BEFORE_TRI_STATES Off
|
||||
set_global_assignment -name AUTO_RESTART_CONFIGURATION On
|
||||
set_global_assignment -name HARDCOPYII_POWER_ON_EXTRA_DELAY Off
|
||||
set_global_assignment -name STRATIXII_MRAM_COMPATIBILITY Off
|
||||
set_global_assignment -name CYCLONEII_M4K_COMPATIBILITY On
|
||||
set_global_assignment -name ENABLE_OCT_DONE Off -family "Arria V"
|
||||
set_global_assignment -name ENABLE_OCT_DONE Off -family "Cyclone 10 LP"
|
||||
set_global_assignment -name ENABLE_OCT_DONE On -family "MAX 10"
|
||||
set_global_assignment -name ENABLE_OCT_DONE Off -family "Cyclone IV E"
|
||||
set_global_assignment -name ENABLE_OCT_DONE Off -family "Arria 10"
|
||||
set_global_assignment -name ENABLE_OCT_DONE Off -family "Stratix V"
|
||||
set_global_assignment -name ENABLE_OCT_DONE Off -family "Arria V GZ"
|
||||
set_global_assignment -name ENABLE_OCT_DONE Off -family "Arria II GX"
|
||||
set_global_assignment -name ENABLE_OCT_DONE Off -family "Cyclone IV GX"
|
||||
set_global_assignment -name ENABLE_OCT_DONE Off -family "Cyclone V"
|
||||
set_global_assignment -name USE_CHECKERED_PATTERN_AS_UNINITIALIZED_RAM_CONTENT OFF
|
||||
set_global_assignment -name ARRIAIIGX_RX_CDR_LOCKUP_FIX_OVERRIDE Off
|
||||
set_global_assignment -name ENABLE_AUTONOMOUS_PCIE_HIP Off
|
||||
set_global_assignment -name ENABLE_ADV_SEU_DETECTION Off
|
||||
set_global_assignment -name POR_SCHEME "Instant ON"
|
||||
set_global_assignment -name EN_USER_IO_WEAK_PULLUP On
|
||||
set_global_assignment -name EN_SPI_IO_WEAK_PULLUP On
|
||||
set_global_assignment -name POF_VERIFY_PROTECT Off
|
||||
set_global_assignment -name ENABLE_SPI_MODE_CHECK Off
|
||||
set_global_assignment -name FORCE_SSMCLK_TO_ISMCLK On
|
||||
set_global_assignment -name FALLBACK_TO_EXTERNAL_FLASH Off
|
||||
set_global_assignment -name EXTERNAL_FLASH_FALLBACK_ADDRESS 0
|
||||
set_global_assignment -name GENERATE_PMSF_FILES On
|
||||
set_global_assignment -name START_TIME 0ns
|
||||
set_global_assignment -name SIMULATION_MODE TIMING
|
||||
set_global_assignment -name AUTO_USE_SIMULATION_PDB_NETLIST Off
|
||||
set_global_assignment -name ADD_DEFAULT_PINS_TO_SIMULATION_OUTPUT_WAVEFORMS On
|
||||
set_global_assignment -name SETUP_HOLD_DETECTION Off
|
||||
set_global_assignment -name SETUP_HOLD_DETECTION_INPUT_REGISTERS_BIDIR_PINS_DISABLED Off
|
||||
set_global_assignment -name CHECK_OUTPUTS Off
|
||||
set_global_assignment -name SIMULATION_COVERAGE On
|
||||
set_global_assignment -name SIMULATION_COMPLETE_COVERAGE_REPORT_PANEL On
|
||||
set_global_assignment -name SIMULATION_MISSING_1_VALUE_COVERAGE_REPORT_PANEL On
|
||||
set_global_assignment -name SIMULATION_MISSING_0_VALUE_COVERAGE_REPORT_PANEL On
|
||||
set_global_assignment -name GLITCH_DETECTION Off
|
||||
set_global_assignment -name GLITCH_INTERVAL 1ns
|
||||
set_global_assignment -name SIMULATOR_GENERATE_SIGNAL_ACTIVITY_FILE Off
|
||||
set_global_assignment -name SIMULATION_WITH_GLITCH_FILTERING_WHEN_GENERATING_SAF On
|
||||
set_global_assignment -name SIMULATION_BUS_CHANNEL_GROUPING Off
|
||||
set_global_assignment -name SIMULATION_VDB_RESULT_FLUSH On
|
||||
set_global_assignment -name VECTOR_COMPARE_TRIGGER_MODE INPUT_EDGE
|
||||
set_global_assignment -name SIMULATION_NETLIST_VIEWER Off
|
||||
set_global_assignment -name SIMULATION_INTERCONNECT_DELAY_MODEL_TYPE TRANSPORT
|
||||
set_global_assignment -name SIMULATION_CELL_DELAY_MODEL_TYPE TRANSPORT
|
||||
set_global_assignment -name SIMULATOR_GENERATE_POWERPLAY_VCD_FILE Off
|
||||
set_global_assignment -name SIMULATOR_PVT_TIMING_MODEL_TYPE AUTO
|
||||
set_global_assignment -name SIMULATION_WITH_AUTO_GLITCH_FILTERING AUTO
|
||||
set_global_assignment -name DRC_TOP_FANOUT 50
|
||||
set_global_assignment -name DRC_FANOUT_EXCEEDING 30
|
||||
set_global_assignment -name DRC_GATED_CLOCK_FEED 30
|
||||
set_global_assignment -name HARDCOPY_FLOW_AUTOMATION MIGRATION_ONLY
|
||||
set_global_assignment -name ENABLE_DRC_SETTINGS Off
|
||||
set_global_assignment -name CLK_RULE_CLKNET_CLKSPINES_THRESHOLD 25
|
||||
set_global_assignment -name DRC_DETAIL_MESSAGE_LIMIT 10
|
||||
set_global_assignment -name DRC_VIOLATION_MESSAGE_LIMIT 30
|
||||
set_global_assignment -name DRC_DEADLOCK_STATE_LIMIT 2
|
||||
set_global_assignment -name MERGE_HEX_FILE Off
|
||||
set_global_assignment -name GENERATE_SVF_FILE Off
|
||||
set_global_assignment -name GENERATE_ISC_FILE Off
|
||||
set_global_assignment -name GENERATE_JAM_FILE Off
|
||||
set_global_assignment -name GENERATE_JBC_FILE Off
|
||||
set_global_assignment -name GENERATE_JBC_FILE_COMPRESSED On
|
||||
set_global_assignment -name GENERATE_CONFIG_SVF_FILE Off
|
||||
set_global_assignment -name GENERATE_CONFIG_ISC_FILE Off
|
||||
set_global_assignment -name GENERATE_CONFIG_JAM_FILE Off
|
||||
set_global_assignment -name GENERATE_CONFIG_JBC_FILE Off
|
||||
set_global_assignment -name GENERATE_CONFIG_JBC_FILE_COMPRESSED On
|
||||
set_global_assignment -name GENERATE_CONFIG_HEXOUT_FILE Off
|
||||
set_global_assignment -name ISP_CLAMP_STATE_DEFAULT "Tri-state"
|
||||
set_global_assignment -name HPS_EARLY_IO_RELEASE Off
|
||||
set_global_assignment -name SIGNALPROBE_ALLOW_OVERUSE Off
|
||||
set_global_assignment -name SIGNALPROBE_DURING_NORMAL_COMPILATION Off
|
||||
set_global_assignment -name POWER_DEFAULT_TOGGLE_RATE 12.5%
|
||||
set_global_assignment -name POWER_DEFAULT_INPUT_IO_TOGGLE_RATE 12.5%
|
||||
set_global_assignment -name POWER_USE_PVA On
|
||||
set_global_assignment -name POWER_USE_INPUT_FILE "No File"
|
||||
set_global_assignment -name POWER_USE_INPUT_FILES Off
|
||||
set_global_assignment -name POWER_VCD_FILTER_GLITCHES On
|
||||
set_global_assignment -name POWER_REPORT_SIGNAL_ACTIVITY Off
|
||||
set_global_assignment -name POWER_REPORT_POWER_DISSIPATION Off
|
||||
set_global_assignment -name POWER_USE_DEVICE_CHARACTERISTICS TYPICAL
|
||||
set_global_assignment -name POWER_AUTO_COMPUTE_TJ On
|
||||
set_global_assignment -name POWER_TJ_VALUE 25
|
||||
set_global_assignment -name POWER_USE_TA_VALUE 25
|
||||
set_global_assignment -name POWER_USE_CUSTOM_COOLING_SOLUTION Off
|
||||
set_global_assignment -name POWER_BOARD_TEMPERATURE 25
|
||||
set_global_assignment -name POWER_HPS_ENABLE Off
|
||||
set_global_assignment -name POWER_HPS_PROC_FREQ 0.0
|
||||
set_global_assignment -name ENABLE_SMART_VOLTAGE_ID Off
|
||||
set_global_assignment -name IGNORE_PARTITIONS Off
|
||||
set_global_assignment -name AUTO_EXPORT_INCREMENTAL_COMPILATION Off
|
||||
set_global_assignment -name RAPID_RECOMPILE_ASSIGNMENT_CHECKING On
|
||||
set_global_assignment -name OUTPUT_IO_TIMING_ENDPOINT "Near End"
|
||||
set_global_assignment -name RTLV_REMOVE_FANOUT_FREE_REGISTERS On
|
||||
set_global_assignment -name RTLV_SIMPLIFIED_LOGIC On
|
||||
set_global_assignment -name RTLV_GROUP_RELATED_NODES On
|
||||
set_global_assignment -name RTLV_GROUP_COMB_LOGIC_IN_CLOUD Off
|
||||
set_global_assignment -name RTLV_GROUP_COMB_LOGIC_IN_CLOUD_TMV Off
|
||||
set_global_assignment -name RTLV_GROUP_RELATED_NODES_TMV On
|
||||
set_global_assignment -name EQC_CONSTANT_DFF_DETECTION On
|
||||
set_global_assignment -name EQC_DUPLICATE_DFF_DETECTION On
|
||||
set_global_assignment -name EQC_BBOX_MERGE On
|
||||
set_global_assignment -name EQC_LVDS_MERGE On
|
||||
set_global_assignment -name EQC_RAM_UNMERGING On
|
||||
set_global_assignment -name EQC_DFF_SS_EMULATION On
|
||||
set_global_assignment -name EQC_RAM_REGISTER_UNPACK On
|
||||
set_global_assignment -name EQC_MAC_REGISTER_UNPACK On
|
||||
set_global_assignment -name EQC_SET_PARTITION_BB_TO_VCC_GND On
|
||||
set_global_assignment -name EQC_STRUCTURE_MATCHING On
|
||||
set_global_assignment -name EQC_AUTO_BREAK_CONE On
|
||||
set_global_assignment -name EQC_POWER_UP_COMPARE Off
|
||||
set_global_assignment -name EQC_AUTO_COMP_LOOP_CUT On
|
||||
set_global_assignment -name EQC_AUTO_INVERSION On
|
||||
set_global_assignment -name EQC_AUTO_TERMINATE On
|
||||
set_global_assignment -name EQC_SUB_CONE_REPORT Off
|
||||
set_global_assignment -name EQC_RENAMING_RULES On
|
||||
set_global_assignment -name EQC_PARAMETER_CHECK On
|
||||
set_global_assignment -name EQC_AUTO_PORTSWAP On
|
||||
set_global_assignment -name EQC_DETECT_DONT_CARES On
|
||||
set_global_assignment -name EQC_SHOW_ALL_MAPPED_POINTS Off
|
||||
set_global_assignment -name EDA_INPUT_GND_NAME GND -section_id ?
|
||||
set_global_assignment -name EDA_INPUT_VCC_NAME VCC -section_id ?
|
||||
set_global_assignment -name EDA_INPUT_DATA_FORMAT NONE -section_id ?
|
||||
set_global_assignment -name EDA_SHOW_LMF_MAPPING_MESSAGES Off -section_id ?
|
||||
set_global_assignment -name EDA_RUN_TOOL_AUTOMATICALLY Off -section_id ?
|
||||
set_global_assignment -name RESYNTHESIS_RETIMING FULL -section_id ?
|
||||
set_global_assignment -name RESYNTHESIS_OPTIMIZATION_EFFORT Normal -section_id ?
|
||||
set_global_assignment -name RESYNTHESIS_PHYSICAL_SYNTHESIS Normal -section_id ?
|
||||
set_global_assignment -name USE_GENERATED_PHYSICAL_CONSTRAINTS On -section_id ?
|
||||
set_global_assignment -name VCCPD_VOLTAGE 3.3V -section_id ?
|
||||
set_global_assignment -name EDA_USER_COMPILED_SIMULATION_LIBRARY_DIRECTORY "<None>" -section_id ?
|
||||
set_global_assignment -name EDA_LAUNCH_CMD_LINE_TOOL Off -section_id ?
|
||||
set_global_assignment -name EDA_ENABLE_IPUTF_MODE On -section_id ?
|
||||
set_global_assignment -name EDA_NATIVELINK_PORTABLE_FILE_PATHS Off -section_id ?
|
||||
set_global_assignment -name EDA_NATIVELINK_GENERATE_SCRIPT_ONLY Off -section_id ?
|
||||
set_global_assignment -name EDA_WAIT_FOR_GUI_TOOL_COMPLETION Off -section_id ?
|
||||
set_global_assignment -name EDA_TRUNCATE_LONG_HIERARCHY_PATHS Off -section_id ?
|
||||
set_global_assignment -name EDA_FLATTEN_BUSES Off -section_id ?
|
||||
set_global_assignment -name EDA_MAP_ILLEGAL_CHARACTERS Off -section_id ?
|
||||
set_global_assignment -name EDA_GENERATE_TIMING_CLOSURE_DATA Off -section_id ?
|
||||
set_global_assignment -name EDA_GENERATE_POWER_INPUT_FILE Off -section_id ?
|
||||
set_global_assignment -name EDA_TEST_BENCH_ENABLE_STATUS NOT_USED -section_id ?
|
||||
set_global_assignment -name EDA_RTL_SIM_MODE NOT_USED -section_id ?
|
||||
set_global_assignment -name EDA_MAINTAIN_DESIGN_HIERARCHY OFF -section_id ?
|
||||
set_global_assignment -name EDA_GENERATE_FUNCTIONAL_NETLIST On -section_id ?
|
||||
set_global_assignment -name EDA_WRITE_DEVICE_CONTROL_PORTS Off -section_id ?
|
||||
set_global_assignment -name EDA_SIMULATION_VCD_OUTPUT_TCL_FILE Off -section_id ?
|
||||
set_global_assignment -name EDA_SIMULATION_VCD_OUTPUT_SIGNALS_TO_TCL_FILE "All Except Combinational Logic Element Outputs" -section_id ?
|
||||
set_global_assignment -name EDA_ENABLE_GLITCH_FILTERING Off -section_id ?
|
||||
set_global_assignment -name EDA_WRITE_NODES_FOR_POWER_ESTIMATION OFF -section_id ?
|
||||
set_global_assignment -name EDA_SETUP_HOLD_DETECTION_INPUT_REGISTERS_BIDIR_PINS_DISABLED Off -section_id ?
|
||||
set_global_assignment -name EDA_WRITER_DONT_WRITE_TOP_ENTITY Off -section_id ?
|
||||
set_global_assignment -name EDA_VHDL_ARCH_NAME structure -section_id ?
|
||||
set_global_assignment -name EDA_IBIS_MODEL_SELECTOR Off -section_id ?
|
||||
set_global_assignment -name EDA_IBIS_EXTENDED_MODEL_SELECTOR Off -section_id ?
|
||||
set_global_assignment -name EDA_IBIS_MUTUAL_COUPLING Off -section_id ?
|
||||
set_global_assignment -name EDA_FORMAL_VERIFICATION_ALLOW_RETIMING Off -section_id ?
|
||||
set_global_assignment -name EDA_BOARD_BOUNDARY_SCAN_OPERATION PRE_CONFIG -section_id ?
|
||||
set_global_assignment -name EDA_GENERATE_RTL_SIMULATION_COMMAND_SCRIPT Off -section_id ?
|
||||
set_global_assignment -name EDA_GENERATE_GATE_LEVEL_SIMULATION_COMMAND_SCRIPT Off -section_id ?
|
||||
set_global_assignment -name EDA_IBIS_SPECIFICATION_VERSION 4p2 -section_id ?
|
||||
set_global_assignment -name SIM_VECTOR_COMPARED_CLOCK_OFFSET 0ns -section_id ?
|
||||
set_global_assignment -name SIM_VECTOR_COMPARED_CLOCK_DUTY_CYCLE 50 -section_id ?
|
||||
set_global_assignment -name APEX20K_CLIQUE_TYPE LAB -section_id ? -entity ?
|
||||
set_global_assignment -name MAX7K_CLIQUE_TYPE LAB -section_id ? -entity ?
|
||||
set_global_assignment -name MERCURY_CLIQUE_TYPE LAB -section_id ? -entity ?
|
||||
set_global_assignment -name FLEX6K_CLIQUE_TYPE LAB -section_id ? -entity ?
|
||||
set_global_assignment -name FLEX10K_CLIQUE_TYPE LAB -section_id ? -entity ?
|
||||
set_global_assignment -name PARTITION_PRESERVE_HIGH_SPEED_TILES On -section_id ? -entity ?
|
||||
set_global_assignment -name PARTITION_IGNORE_SOURCE_FILE_CHANGES Off -section_id ? -entity ?
|
||||
set_global_assignment -name PARTITION_ALWAYS_USE_QXP_NETLIST Off -section_id ? -entity ?
|
||||
set_global_assignment -name PARTITION_IMPORT_ASSIGNMENTS On -section_id ? -entity ?
|
||||
set_global_assignment -name PARTITION_IMPORT_EXISTING_ASSIGNMENTS REPLACE_CONFLICTING -section_id ? -entity ?
|
||||
set_global_assignment -name PARTITION_IMPORT_EXISTING_LOGICLOCK_REGIONS UPDATE_CONFLICTING -section_id ? -entity ?
|
||||
set_global_assignment -name PARTITION_IMPORT_PROMOTE_ASSIGNMENTS On -section_id ? -entity ?
|
||||
set_global_assignment -name ALLOW_MULTIPLE_PERSONAS Off -section_id ? -entity ?
|
||||
set_global_assignment -name PARTITION_ASD_REGION_ID 1 -section_id ? -entity ?
|
||||
set_global_assignment -name CROSS_BOUNDARY_OPTIMIZATIONS Off -section_id ? -entity ?
|
||||
set_global_assignment -name PROPAGATE_CONSTANTS_ON_INPUTS On -section_id ? -entity ?
|
||||
set_global_assignment -name PROPAGATE_INVERSIONS_ON_INPUTS On -section_id ? -entity ?
|
||||
set_global_assignment -name REMOVE_LOGIC_ON_UNCONNECTED_OUTPUTS On -section_id ? -entity ?
|
||||
set_global_assignment -name MERGE_EQUIVALENT_INPUTS On -section_id ? -entity ?
|
||||
set_global_assignment -name MERGE_EQUIVALENT_BIDIRS On -section_id ? -entity ?
|
||||
set_global_assignment -name ABSORB_PATHS_FROM_OUTPUTS_TO_INPUTS On -section_id ? -entity ?
|
||||
set_global_assignment -name PARTITION_ENABLE_STRICT_PRESERVATION Off -section_id ? -entity ?
|
@ -5,6 +5,18 @@
|
||||
int task_add_run( void * task ) {
|
||||
|
||||
// TODO
|
||||
add_config * config = ( add_config * ) task;
|
||||
|
||||
// Nachfolgende Antworten lesen..
|
||||
for ( uint32_t i = 0; i < DATA_CHANNEL_DEPTH; i++) {
|
||||
float a;
|
||||
data_channel_read( config->sources[ 0 ], ( uint32_t * ) & a );
|
||||
float b;
|
||||
data_channel_read( config->sources[ 1 ], ( uint32_t * ) & b );
|
||||
float_word c;
|
||||
c.value = a + b;
|
||||
data_channel_write( config->sink, c.word );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,11 +1,119 @@
|
||||
#include "system/task_crc.h"
|
||||
#include "system/data_channel.h"
|
||||
#include "system/float_word.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
// Funktion zur Berechnung des CRC32
|
||||
void berechne_crc32(uint32_t data, uint32_t * crc);
|
||||
void crc32( uint32_t data, uint32_t* crc );
|
||||
|
||||
int task_crc_run( void * task ) {
|
||||
crc_config * config = (crc_config*) task;
|
||||
uint32_t value = config->start;
|
||||
// Nachfolgende Antworten Lesen den FIFO der ersten Datenquelle aus und multiplizieren
|
||||
// den jeweils gelesenen Wert mit 4 und speichern das Ergebnis in der Datensenke
|
||||
for (uint32_t i = 0; i < DATA_CHANNEL_DEPTH; ++i) {
|
||||
float_word a;
|
||||
data_channel_read(config->base.sources[0], (uint32_t * ) & a.value );
|
||||
//if (i<10) {printf("\n Input %i DATA; %x\ CRC: %x\n", i, a.word, value);}
|
||||
berechne_crc32(a.word, &value); //Startwert jedes Mal, oder mit vorheriger crc starten?
|
||||
//if (i<10) {printf("\n CRC Zwischenwert Output(%i): %x\n", i, value);}
|
||||
}
|
||||
printf("CRC Wert: %x\n", value);
|
||||
data_channel_write( config->base.sink, value);
|
||||
|
||||
// TODO
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO
|
||||
// Funktion zur Berechnung des CRC32
|
||||
void crc32( uint32_t data, uint32_t* crc ) {
|
||||
uint32_t byte_array[4];
|
||||
uint32_t reg32 = ~*crc;
|
||||
|
||||
byte_array[3] = (uint32_t) (data>>24) & 0x000000FF;
|
||||
byte_array[2] = (uint32_t) (data>>16) & 0x000000FF;
|
||||
byte_array[1] = (uint32_t) (data>>8) & 0x000000FF;
|
||||
byte_array[0] = (uint32_t) (data) & 0x000000FF;
|
||||
|
||||
for ( uint32_t i = 0; i < 4; ++i ) {
|
||||
for ( uint8_t j = 0; j < 8; ++j ) {
|
||||
|
||||
if ((reg32&1) != (byte_array[i]&1)) { // != hat Prio 7, & hat Prio 8!
|
||||
reg32 = (reg32>>1)^CRC32POLY;
|
||||
}
|
||||
else {
|
||||
reg32 >>= 1;
|
||||
}
|
||||
|
||||
byte_array[i] >>= 1;
|
||||
}
|
||||
*crc= reg32 ^ 0xffffffff; //inverses Ergebnis, MSB zuerst
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void berechne_crc32(uint32_t data, uint32_t * crc) {
|
||||
uint32_t bytes[4]; //Reihenfolge richtig?
|
||||
uint32_t reg32 = ~*crc;
|
||||
|
||||
bytes[0] = (uint32_t) (data) & 0x000000FF;
|
||||
bytes[1] = (uint32_t) (data >>8) & 0x000000FF;
|
||||
bytes[2] = (uint32_t) (data >>16) & 0x000000FF;
|
||||
bytes[3] = (uint32_t) (data >>24) & 0x000000FF; //aufffüllen
|
||||
|
||||
for (uint32_t i = 0; i < 4; i++) {
|
||||
//von rechts nch links
|
||||
for (uint8_t j = 0; j <8; j++) {
|
||||
|
||||
// Prüfen, ob das am weitesten rechts stehende Bit von crc 1 ist
|
||||
if ((reg32 & 1) != (bytes[i] & 1)) { //Wieso crc & 1?
|
||||
reg32 = (reg32 >> 1)^CRC32POLY; // XOR mit dem Polynom
|
||||
} else {
|
||||
reg32 >>= 1;
|
||||
}
|
||||
bytes[i]>>=1;
|
||||
}
|
||||
*crc = reg32 ^0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
crc := 0000… (Startwert)
|
||||
für alle Bits b im Datenstrom:
|
||||
wenn das am weitesten links stehende Bit von crc 1 ist:
|
||||
crc := (crc * 2 + b) xor CRC-Polynom
|
||||
sonst:
|
||||
crc := crc * 2 + b
|
||||
crc enthält das Ergebnis.
|
||||
*/
|
||||
/*
|
||||
for (uint32_t j = 0; j < 32; j++) {
|
||||
if (a.word & (1<<31)) {
|
||||
c.word = (c.word * 2 + ((a.word & (1<<j))>>j)) ^ CRC32POLY;
|
||||
} else {
|
||||
c.word = (c.word * 2 + ((a.word & (1<<j))>>j));
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
const uint8_t bitstream[] = { 1,0,0,0,1,1,0,0 };
|
||||
const int bitcount = 8;
|
||||
uint32_t crc32 = 0; // Schieberegister
|
||||
|
||||
int main ()
|
||||
{
|
||||
for (int i = 0; i < bitcount; i++)
|
||||
{
|
||||
if ( ((crc32 >> 31) & 1) != bitstream[i])
|
||||
crc32 = (crc32 << 1) ^ CRC32POLY;
|
||||
else
|
||||
crc32 = (crc32 << 1);
|
||||
}
|
||||
printf ("0x%08X\n", crc32);
|
||||
}
|
||||
*/
|
||||
|
@ -8,13 +8,13 @@
|
||||
int main()
|
||||
{
|
||||
uint32_t bindings[ TASK_COUNT ] = {
|
||||
BINDING_SW,
|
||||
BINDING_SW,
|
||||
BINDING_SW,
|
||||
BINDING_SW,
|
||||
BINDING_HW,
|
||||
BINDING_SW,
|
||||
BINDING_SW
|
||||
BINDING_HW,
|
||||
BINDING_HW,
|
||||
BINDING_HW,
|
||||
BINDING_HW,
|
||||
BINDING_HW,
|
||||
BINDING_HW
|
||||
};
|
||||
|
||||
SignalProcessing system;
|
||||
|
@ -1,10 +1,28 @@
|
||||
#include "system/task_sine.h"
|
||||
#include "system/data_channel.h"
|
||||
//Aus dem Skript kopiert:
|
||||
#include "system/task_sine.h"
|
||||
#include "system/hardware_task.h"
|
||||
#include "system/sine_config.h"
|
||||
#include "system/data_channel.h"
|
||||
#include "system/float_word.h"
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <system.h>
|
||||
|
||||
int task_sine_run( void * data ) {
|
||||
int task_sine_run( void * data) {
|
||||
|
||||
// TODO
|
||||
// Nachfolgende Anweisungen Schreiben 1024 Mal den Wert 4 in den FIFO für Sinus
|
||||
sine_config * task = (sine_config * ) data;
|
||||
uint32_t data_channel_base = task->base.sink;
|
||||
data_channel_clear( data_channel_base );
|
||||
|
||||
return 0;
|
||||
for (uint32_t i = 0; i < DATA_CHANNEL_DEPTH; ++i) {
|
||||
|
||||
float_word res;
|
||||
res.value = task->amplitude * sin(task->phase + i *2 * M_PI / task->samples_per_periode);
|
||||
|
||||
data_channel_write( data_channel_base, res.word );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ extern "C" {
|
||||
extern crc_config CRC_CONFIG;
|
||||
|
||||
#define CRC32POLY 0xEDB88320 /* CRC-32 Polynom (Invers)*/
|
||||
//#define CRC32POLY 0x04C11DB7
|
||||
|
||||
int task_crc_run( void * task );
|
||||
|
||||
|
0
software/signal_processing_bsp/.force_relink
Normal file
0
software/signal_processing_bsp/.force_relink
Normal file
54
software/signal_processing_bsp/HAL/inc/alt_types.h
Normal file
54
software/signal_processing_bsp/HAL/inc/alt_types.h
Normal file
@ -0,0 +1,54 @@
|
||||
#ifndef __ALT_TYPES_H__
|
||||
#define __ALT_TYPES_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Don't declare these typedefs if this file is included by assembly source.
|
||||
*/
|
||||
#ifndef ALT_ASM_SRC
|
||||
typedef signed char alt_8;
|
||||
typedef unsigned char alt_u8;
|
||||
typedef signed short alt_16;
|
||||
typedef unsigned short alt_u16;
|
||||
typedef signed long alt_32;
|
||||
typedef unsigned long alt_u32;
|
||||
typedef long long alt_64;
|
||||
typedef unsigned long long alt_u64;
|
||||
#endif
|
||||
|
||||
#define ALT_INLINE __inline__
|
||||
#define ALT_ALWAYS_INLINE __attribute__ ((always_inline))
|
||||
#define ALT_WEAK __attribute__((weak))
|
||||
|
||||
#endif /* __ALT_TYPES_H__ */
|
@ -0,0 +1,80 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Support for the Nios II internal interrupt controller.
|
||||
*/
|
||||
|
||||
#ifndef __ALT_NIOS2_GEN2_IRQ_H__
|
||||
#define __ALT_NIOS2_GEN2_IRQ_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* The macro ALTERA_NIOS2_GEN2_IRQ_INSTANCE is used by the alt_irq_init()
|
||||
* function in the auto-generated file alt_sys_init.c to create an
|
||||
* instance of this interrupt controller device driver state if this
|
||||
* module contains an interrupt controller.
|
||||
* Only one instance of a Nios II is allowed so this macro is just empty.
|
||||
*/
|
||||
|
||||
#define ALTERA_NIOS2_GEN2_IRQ_INSTANCE(name, state)
|
||||
|
||||
/*
|
||||
* altera_nios2_gen2_irq_init() is called by the auto-generated function
|
||||
* alt_irq_init() once for the Nios II if it contains an interrupt controller.
|
||||
* The altera_nios2_gen2_irq_init() routine is called using the
|
||||
* ALTERA_NIOS2_GEN2_IRQ_INIT macro given below.
|
||||
*
|
||||
* This function initializes the internal interrupt controller
|
||||
* so is not called if the Nios II contains an external interrupt
|
||||
* controller port (because the internal interrupt controller
|
||||
* is removed if this port is present).
|
||||
*/
|
||||
|
||||
extern void altera_nios2_gen2_irq_init( void );
|
||||
|
||||
/*
|
||||
* The macro ALTERA_NIOS2_GEN2_IRQ_INIT is used by the alt_irq_init() routine
|
||||
* in the auto-generated file alt_sys_init.c to initialize an instance
|
||||
* of the interrupt controller device driver state.
|
||||
*/
|
||||
|
||||
#define ALTERA_NIOS2_GEN2_IRQ_INIT(name, state) altera_nios2_gen2_irq_init()
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __ALT_NIOS2_ULTRA_IRQ_H__ */
|
||||
|
81
software/signal_processing_bsp/HAL/inc/io.h
Normal file
81
software/signal_processing_bsp/HAL/inc/io.h
Normal file
@ -0,0 +1,81 @@
|
||||
#ifndef __IO_H__
|
||||
#define __IO_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/* IO Header file for Nios II Toolchain */
|
||||
|
||||
#include "alt_types.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifndef SYSTEM_BUS_WIDTH
|
||||
#define SYSTEM_BUS_WIDTH 32
|
||||
#endif
|
||||
|
||||
/* Dynamic bus access functions */
|
||||
|
||||
#define __IO_CALC_ADDRESS_DYNAMIC(BASE, OFFSET) \
|
||||
((void *)(((alt_u8*)BASE) + (OFFSET)))
|
||||
|
||||
#define IORD_32DIRECT(BASE, OFFSET) \
|
||||
__builtin_ldwio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET)))
|
||||
#define IORD_16DIRECT(BASE, OFFSET) \
|
||||
__builtin_ldhuio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET)))
|
||||
#define IORD_8DIRECT(BASE, OFFSET) \
|
||||
__builtin_ldbuio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET)))
|
||||
|
||||
#define IOWR_32DIRECT(BASE, OFFSET, DATA) \
|
||||
__builtin_stwio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET)), (DATA))
|
||||
#define IOWR_16DIRECT(BASE, OFFSET, DATA) \
|
||||
__builtin_sthio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET)), (DATA))
|
||||
#define IOWR_8DIRECT(BASE, OFFSET, DATA) \
|
||||
__builtin_stbio (__IO_CALC_ADDRESS_DYNAMIC ((BASE), (OFFSET)), (DATA))
|
||||
|
||||
/* Native bus access functions */
|
||||
|
||||
#define __IO_CALC_ADDRESS_NATIVE(BASE, REGNUM) \
|
||||
((void *)(((alt_u8*)BASE) + ((REGNUM) * (SYSTEM_BUS_WIDTH/8))))
|
||||
|
||||
#define IORD(BASE, REGNUM) \
|
||||
__builtin_ldwio (__IO_CALC_ADDRESS_NATIVE ((BASE), (REGNUM)))
|
||||
#define IOWR(BASE, REGNUM, DATA) \
|
||||
__builtin_stwio (__IO_CALC_ADDRESS_NATIVE ((BASE), (REGNUM)), (DATA))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __IO_H__ */
|
300
software/signal_processing_bsp/HAL/inc/nios2.h
Normal file
300
software/signal_processing_bsp/HAL/inc/nios2.h
Normal file
@ -0,0 +1,300 @@
|
||||
#ifndef __NIOS2_H__
|
||||
#define __NIOS2_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* This header provides processor specific macros for accessing the Nios2
|
||||
* control registers.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Number of available IRQs in internal interrupt controller.
|
||||
*/
|
||||
#define NIOS2_NIRQ 32
|
||||
|
||||
/*
|
||||
* Macros for accessing select Nios II general-purpose registers.
|
||||
*/
|
||||
|
||||
/* ET (Exception Temporary) register */
|
||||
#define NIOS2_READ_ET(et) \
|
||||
do { __asm ("mov %0, et" : "=r" (et) ); } while (0)
|
||||
|
||||
#define NIOS2_WRITE_ET(et) \
|
||||
do { __asm volatile ("mov et, %z0" : : "rM" (et)); } while (0)
|
||||
|
||||
/* SP (Stack Pointer) register */
|
||||
#define NIOS2_READ_SP(sp) \
|
||||
do { __asm ("mov %0, sp" : "=r" (sp) ); } while (0)
|
||||
|
||||
/*
|
||||
* Macros for useful processor instructions.
|
||||
*/
|
||||
#define NIOS2_BREAK() \
|
||||
do { __asm volatile ("break"); } while (0)
|
||||
|
||||
#define NIOS2_REPORT_STACK_OVERFLOW() \
|
||||
do { __asm volatile("break 3"); } while (0)
|
||||
|
||||
/*
|
||||
* Macros for accessing Nios II control registers.
|
||||
*/
|
||||
#define NIOS2_READ_STATUS(dest) \
|
||||
do { dest = __builtin_rdctl(0); } while (0)
|
||||
|
||||
#define NIOS2_WRITE_STATUS(src) \
|
||||
do { __builtin_wrctl(0, src); } while (0)
|
||||
|
||||
#define NIOS2_READ_ESTATUS(dest) \
|
||||
do { dest = __builtin_rdctl(1); } while (0)
|
||||
|
||||
#define NIOS2_READ_BSTATUS(dest) \
|
||||
do { dest = __builtin_rdctl(2); } while (0)
|
||||
|
||||
#define NIOS2_READ_IENABLE(dest) \
|
||||
do { dest = __builtin_rdctl(3); } while (0)
|
||||
|
||||
#define NIOS2_WRITE_IENABLE(src) \
|
||||
do { __builtin_wrctl(3, src); } while (0)
|
||||
|
||||
#define NIOS2_READ_IPENDING(dest) \
|
||||
do { dest = __builtin_rdctl(4); } while (0)
|
||||
|
||||
#define NIOS2_READ_CPUID(dest) \
|
||||
do { dest = __builtin_rdctl(5); } while (0)
|
||||
|
||||
#define NIOS2_READ_EXCEPTION(dest) \
|
||||
do { dest = __builtin_rdctl(7); } while (0)
|
||||
|
||||
#define NIOS2_READ_PTEADDR(dest) \
|
||||
do { dest = __builtin_rdctl(8); } while (0)
|
||||
|
||||
#define NIOS2_WRITE_PTEADDR(src) \
|
||||
do { __builtin_wrctl(8, src); } while (0)
|
||||
|
||||
#define NIOS2_READ_TLBACC(dest) \
|
||||
do { dest = __builtin_rdctl(9); } while (0)
|
||||
|
||||
#define NIOS2_WRITE_TLBACC(src) \
|
||||
do { __builtin_wrctl(9, src); } while (0)
|
||||
|
||||
#define NIOS2_READ_TLBMISC(dest) \
|
||||
do { dest = __builtin_rdctl(10); } while (0)
|
||||
|
||||
#define NIOS2_WRITE_TLBMISC(src) \
|
||||
do { __builtin_wrctl(10, src); } while (0)
|
||||
|
||||
#define NIOS2_READ_ECCINJ(dest) \
|
||||
do { dest = __builtin_rdctl(11); } while (0)
|
||||
|
||||
#define NIOS2_WRITE_ECCINJ(src) \
|
||||
do { __builtin_wrctl(11, src); } while (0)
|
||||
|
||||
#define NIOS2_READ_BADADDR(dest) \
|
||||
do { dest = __builtin_rdctl(12); } while (0)
|
||||
|
||||
#define NIOS2_WRITE_CONFIG(src) \
|
||||
do { __builtin_wrctl(13, src); } while (0)
|
||||
|
||||
#define NIOS2_READ_CONFIG(dest) \
|
||||
do { dest = __builtin_rdctl(13); } while (0)
|
||||
|
||||
#define NIOS2_WRITE_MPUBASE(src) \
|
||||
do { __builtin_wrctl(14, src); } while (0)
|
||||
|
||||
#define NIOS2_READ_MPUBASE(dest) \
|
||||
do { dest = __builtin_rdctl(14); } while (0)
|
||||
|
||||
#define NIOS2_WRITE_MPUACC(src) \
|
||||
do { __builtin_wrctl(15, src); } while (0)
|
||||
|
||||
#define NIOS2_READ_MPUACC(dest) \
|
||||
do { dest = __builtin_rdctl(15); } while (0)
|
||||
|
||||
/*
|
||||
* Nios II control registers that are always present
|
||||
*/
|
||||
#define NIOS2_STATUS status
|
||||
#define NIOS2_ESTATUS estatus
|
||||
#define NIOS2_BSTATUS bstatus
|
||||
#define NIOS2_IENABLE ienable
|
||||
#define NIOS2_IPENDING ipending
|
||||
#define NIOS2_CPUID cpuid
|
||||
|
||||
/*
|
||||
* Bit masks & offsets for Nios II control registers.
|
||||
* The presence and size of a field is sometimes dependent on the Nios II
|
||||
* configuration. Bit masks for every possible field and the maximum size of
|
||||
* that field are defined.
|
||||
*
|
||||
* All bit-masks are expressed relative to the position
|
||||
* of the data with a register. To read data that is LSB-
|
||||
* aligned, the register read data should be masked, then
|
||||
* right-shifted by the designated "OFST" macro value. The
|
||||
* opposite should be used for register writes when starting
|
||||
* with LSB-aligned data.
|
||||
*/
|
||||
|
||||
/* STATUS, ESTATUS, BSTATUS, and SSTATUS registers */
|
||||
#define NIOS2_STATUS_PIE_MSK (0x00000001)
|
||||
#define NIOS2_STATUS_PIE_OFST (0)
|
||||
#define NIOS2_STATUS_U_MSK (0x00000002)
|
||||
#define NIOS2_STATUS_U_OFST (1)
|
||||
#define NIOS2_STATUS_EH_MSK (0x00000004)
|
||||
#define NIOS2_STATUS_EH_OFST (2)
|
||||
#define NIOS2_STATUS_IH_MSK (0x00000008)
|
||||
#define NIOS2_STATUS_IH_OFST (3)
|
||||
#define NIOS2_STATUS_IL_MSK (0x000003f0)
|
||||
#define NIOS2_STATUS_IL_OFST (4)
|
||||
#define NIOS2_STATUS_CRS_MSK (0x0000fc00)
|
||||
#define NIOS2_STATUS_CRS_OFST (10)
|
||||
#define NIOS2_STATUS_PRS_MSK (0x003f0000)
|
||||
#define NIOS2_STATUS_PRS_OFST (16)
|
||||
#define NIOS2_STATUS_NMI_MSK (0x00400000)
|
||||
#define NIOS2_STATUS_NMI_OFST (22)
|
||||
#define NIOS2_STATUS_RSIE_MSK (0x00800000)
|
||||
#define NIOS2_STATUS_RSIE_OFST (23)
|
||||
#define NIOS2_STATUS_SRS_MSK (0x80000000)
|
||||
#define NIOS2_STATUS_SRS_OFST (31)
|
||||
|
||||
/* EXCEPTION register */
|
||||
#define NIOS2_EXCEPTION_REG_CAUSE_MASK (0x0000007c)
|
||||
#define NIOS2_EXCEPTION_REG_CAUSE_OFST (2)
|
||||
#define NIOS2_EXCEPTION_REG_ECCFTL_MASK (0x80000000)
|
||||
#define NIOS2_EXCEPTION_REG_ECCFTL_OFST (31)
|
||||
|
||||
/* PTEADDR (Page Table Entry Address) register */
|
||||
#define NIOS2_PTEADDR_REG_VPN_OFST 2
|
||||
#define NIOS2_PTEADDR_REG_VPN_MASK 0x3ffffc
|
||||
#define NIOS2_PTEADDR_REG_PTBASE_OFST 22
|
||||
#define NIOS2_PTEADDR_REG_PTBASE_MASK 0xffc00000
|
||||
|
||||
/* TLBACC (TLB Access) register */
|
||||
#define NIOS2_TLBACC_REG_PFN_OFST 0
|
||||
#define NIOS2_TLBACC_REG_PFN_MASK 0xfffff
|
||||
#define NIOS2_TLBACC_REG_G_OFST 20
|
||||
#define NIOS2_TLBACC_REG_G_MASK 0x100000
|
||||
#define NIOS2_TLBACC_REG_X_OFST 21
|
||||
#define NIOS2_TLBACC_REG_X_MASK 0x200000
|
||||
#define NIOS2_TLBACC_REG_W_OFST 22
|
||||
#define NIOS2_TLBACC_REG_W_MASK 0x400000
|
||||
#define NIOS2_TLBACC_REG_R_OFST 23
|
||||
#define NIOS2_TLBACC_REG_R_MASK 0x800000
|
||||
#define NIOS2_TLBACC_REG_C_OFST 24
|
||||
#define NIOS2_TLBACC_REG_C_MASK 0x1000000
|
||||
#define NIOS2_TLBACC_REG_IG_OFST 25
|
||||
#define NIOS2_TLBACC_REG_IG_MASK 0xfe000000
|
||||
|
||||
/* TLBMISC (TLB Miscellaneous) register */
|
||||
#define NIOS2_TLBMISC_REG_D_OFST 0
|
||||
#define NIOS2_TLBMISC_REG_D_MASK 0x1
|
||||
#define NIOS2_TLBMISC_REG_PERM_OFST 1
|
||||
#define NIOS2_TLBMISC_REG_PERM_MASK 0x2
|
||||
#define NIOS2_TLBMISC_REG_BAD_OFST 2
|
||||
#define NIOS2_TLBMISC_REG_BAD_MASK 0x4
|
||||
#define NIOS2_TLBMISC_REG_DBL_OFST 3
|
||||
#define NIOS2_TLBMISC_REG_DBL_MASK 0x8
|
||||
#define NIOS2_TLBMISC_REG_PID_OFST 4
|
||||
#define NIOS2_TLBMISC_REG_PID_MASK 0x3fff0
|
||||
#define NIOS2_TLBMISC_REG_WE_OFST 18
|
||||
#define NIOS2_TLBMISC_REG_WE_MASK 0x40000
|
||||
#define NIOS2_TLBMISC_REG_RD_OFST 19
|
||||
#define NIOS2_TLBMISC_REG_RD_MASK 0x80000
|
||||
#define NIOS2_TLBMISC_REG_WAY_OFST 20
|
||||
#define NIOS2_TLBMISC_REG_WAY_MASK 0xf00000
|
||||
#define NIOS2_TLBMISC_REG_EE_OFST 24
|
||||
#define NIOS2_TLBMISC_REG_EE_MASK 0x1000000
|
||||
|
||||
/* ECCINJ (ECC Inject) register */
|
||||
#define NIOS2_ECCINJ_REG_RF_OFST 0
|
||||
#define NIOS2_ECCINJ_REG_RF_MASK 0x3
|
||||
#define NIOS2_ECCINJ_REG_ICTAG_OFST 2
|
||||
#define NIOS2_ECCINJ_REG_ICTAG_MASK 0xc
|
||||
#define NIOS2_ECCINJ_REG_ICDAT_OFST 4
|
||||
#define NIOS2_ECCINJ_REG_ICDAT_MASK 0x30
|
||||
#define NIOS2_ECCINJ_REG_DCTAG_OFST 6
|
||||
#define NIOS2_ECCINJ_REG_DCTAG_MASK 0xc0
|
||||
#define NIOS2_ECCINJ_REG_DCDAT_OFST 8
|
||||
#define NIOS2_ECCINJ_REG_DCDAT_MASK 0x300
|
||||
#define NIOS2_ECCINJ_REG_TLB_OFST 10
|
||||
#define NIOS2_ECCINJ_REG_TLB_MASK 0xc00
|
||||
#define NIOS2_ECCINJ_REG_DTCM0_OFST 12
|
||||
#define NIOS2_ECCINJ_REG_DTCM0_MASK 0x3000
|
||||
#define NIOS2_ECCINJ_REG_DTCM1_OFST 14
|
||||
#define NIOS2_ECCINJ_REG_DTCM1_MASK 0xc000
|
||||
#define NIOS2_ECCINJ_REG_DTCM2_OFST 16
|
||||
#define NIOS2_ECCINJ_REG_DTCM2_MASK 0x30000
|
||||
#define NIOS2_ECCINJ_REG_DTCM3_OFST 18
|
||||
#define NIOS2_ECCINJ_REG_DTCM3_MASK 0xc0000
|
||||
|
||||
/* CONFIG register */
|
||||
#define NIOS2_CONFIG_REG_PE_MASK (0x00000001)
|
||||
#define NIOS2_CONFIG_REG_PE_OFST (0)
|
||||
#define NIOS2_CONFIG_REG_ANI_MASK (0x00000002)
|
||||
#define NIOS2_CONFIG_REG_ANI_OFST (1)
|
||||
#define NIOS2_CONFIG_REG_ECCEN_MASK (0x00000004)
|
||||
#define NIOS2_CONFIG_REG_ECCEN_OFST (2)
|
||||
#define NIOS2_CONFIG_REG_ECCEXC_MASK (0x00000008)
|
||||
#define NIOS2_CONFIG_REG_ECCEXC_OFST (3)
|
||||
|
||||
/* MPUBASE (MPU Base Address) Register */
|
||||
#define NIOS2_MPUBASE_D_MASK (0x00000001)
|
||||
#define NIOS2_MPUBASE_D_OFST (0)
|
||||
#define NIOS2_MPUBASE_INDEX_MASK (0x0000003e)
|
||||
#define NIOS2_MPUBASE_INDEX_OFST (1)
|
||||
#define NIOS2_MPUBASE_BASE_ADDR_MASK (0xffffffc0)
|
||||
#define NIOS2_MPUBASE_BASE_ADDR_OFST (6)
|
||||
|
||||
/* MPUACC (MPU Access) Register */
|
||||
#define NIOS2_MPUACC_LIMIT_MASK (0xffffffc0)
|
||||
#define NIOS2_MPUACC_LIMIT_OFST (6)
|
||||
#define NIOS2_MPUACC_MASK_MASK (0xffffffc0)
|
||||
#define NIOS2_MPUACC_MASK_OFST (6)
|
||||
#define NIOS2_MPUACC_C_MASK (0x00000020)
|
||||
#define NIOS2_MPUACC_C_OFST (5)
|
||||
#define NIOS2_MPUACC_PERM_MASK (0x0000001c)
|
||||
#define NIOS2_MPUACC_PERM_OFST (2)
|
||||
#define NIOS2_MPUACC_RD_MASK (0x00000002)
|
||||
#define NIOS2_MPUACC_RD_OFST (1)
|
||||
#define NIOS2_MPUACC_WR_MASK (0x00000001)
|
||||
#define NIOS2_MPUACC_WR_OFST (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __NIOS2_H__ */
|
98
software/signal_processing_bsp/HAL/inc/os/alt_flag.h
Normal file
98
software/signal_processing_bsp/HAL/inc/os/alt_flag.h
Normal file
@ -0,0 +1,98 @@
|
||||
#ifndef __ALT_FLAG_H__
|
||||
#define __ALT_FLAG_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* This header provides macro definitions that can be used to create and use
|
||||
* uc/OS-II style event flags. These macros can be used in both a uC/OS-II based
|
||||
* environment, and a single threaded HAL based environment.
|
||||
*
|
||||
* The motivation for these macros is to allow code to be developed which is
|
||||
* thread safe under uC/OS-II, but incurs no additional overhead when used in a
|
||||
* single threaded HAL environment.
|
||||
*
|
||||
* In the case of a single threaded HAL environment, they compile to
|
||||
* "do nothing" directives, which ensures they do not contribute to the final
|
||||
* executable.
|
||||
*
|
||||
* The following macros are available:
|
||||
*
|
||||
* ALT_FLAG_GRP - Create a flag group instance.
|
||||
* ALT_EXTERN_FLAG_GRP - Create a reference to an external flag group instance.
|
||||
* ALT_STATIC_FLAG_GRP - Create a static flag group instance.
|
||||
* ALT_FLAG_CREATE - Initialise a flag group.
|
||||
* ALT_FLAG_PEND - Pend on a flag group.
|
||||
* ALT_FLAG_POST - Set a flag condition.
|
||||
|
||||
*
|
||||
* Input arguments and return codes are all consistant with the equivalent
|
||||
* uC/OS-II function.
|
||||
*
|
||||
* It's important to be careful in the use of the macros: ALT_FLAG_GRP,
|
||||
* ALT_EXTERN_FLAG_GRP, and ALT_STATIC_FLAG_GRP. In these three cases the
|
||||
* semi-colon is included in the macro definition; so, for example, you should
|
||||
* use:
|
||||
*
|
||||
* ALT_FLAG_GRP(mygroup)
|
||||
*
|
||||
* not:
|
||||
*
|
||||
* ALT_FLAG_GRP(mygroup);
|
||||
*
|
||||
* The inclusion of the semi-colon has been necessary to ensure the macros can
|
||||
* compile with no warnings when used in a single threaded HAL environment.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "priv/alt_no_error.h"
|
||||
|
||||
#define ALT_FLAG_GRP(group)
|
||||
#define ALT_EXTERN_FLAG_GRP(group)
|
||||
#define ALT_STATIC_FLAG_GRP(group)
|
||||
|
||||
#define ALT_FLAG_CREATE(group, flags) alt_no_error ()
|
||||
#define ALT_FLAG_PEND(group, flags, wait_type, timeout) alt_no_error ()
|
||||
#define ALT_FLAG_POST(group, flags, opt) alt_no_error ()
|
||||
|
||||
#ifndef ALT_SINGLE_THREADED
|
||||
#define ALT_SINGLE_THREADED
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_FLAG_H__ */
|
61
software/signal_processing_bsp/HAL/inc/os/alt_hooks.h
Normal file
61
software/signal_processing_bsp/HAL/inc/os/alt_hooks.h
Normal file
@ -0,0 +1,61 @@
|
||||
#ifndef __ALT_HOOKS_H__
|
||||
#define __ALT_HOOKS_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* This header provides "do-nothing" macro definitions for operating system
|
||||
* hooks within the HAL. The O/S component can override these to provide it's
|
||||
* own implementation.
|
||||
*/
|
||||
|
||||
#define ALT_OS_TIME_TICK() while(0)
|
||||
#define ALT_OS_INIT() while(0)
|
||||
#define ALT_OS_STOP() while(0)
|
||||
|
||||
/* Call from assembly code */
|
||||
#define ALT_OS_INT_ENTER_ASM
|
||||
#define ALT_OS_INT_EXIT_ASM
|
||||
|
||||
/* Call from C code */
|
||||
#define ALT_OS_INT_ENTER() while(0)
|
||||
#define ALT_OS_INT_EXIT() while(0)
|
||||
|
||||
|
||||
#endif /* __ALT_HOOKS_H__ */
|
96
software/signal_processing_bsp/HAL/inc/os/alt_sem.h
Normal file
96
software/signal_processing_bsp/HAL/inc/os/alt_sem.h
Normal file
@ -0,0 +1,96 @@
|
||||
#ifndef __ALT_SEM_H__
|
||||
#define __ALT_SEM_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* This header provides macro definitions that can be used to create and use
|
||||
* semaphores. These macros can be used in both a uC/OS-II based environment,
|
||||
* and a single threaded HAL based environment.
|
||||
*
|
||||
* The motivation for these macros is to allow code to be developed which is
|
||||
* thread safe under uC/OS-II, but incurs no additional overhead when used in a
|
||||
* single threaded HAL environment.
|
||||
*
|
||||
* In the case of a single threaded HAL environment, they compile to
|
||||
* "do nothing" directives, which ensures they do not contribute to the final
|
||||
* executable.
|
||||
*
|
||||
* The following macros are available:
|
||||
*
|
||||
* ALT_SEM - Create a semaphore instance.
|
||||
* ALT_EXTERN_SEM - Create a reference to an external semaphore instance.
|
||||
* ALT_STATIC_SEM - Create a static semaphore instance.
|
||||
* ALT_SEM_CREATE - Initialise a semaphore.
|
||||
* ALT_SEM_PEND - Pend on a semaphore.
|
||||
* ALT_SEM_POST - Increment a semaphore.
|
||||
*
|
||||
* Input arguments and return codes are all consistant with the equivalent
|
||||
* uC/OS-II function.
|
||||
*
|
||||
* It's important to be careful in the use of the macros: ALT_SEM,
|
||||
* ALT_EXTERN_SEM, and ALT_STATIC_SEM. In these three cases the semi-colon is
|
||||
* included in the macro definition; so, for example, you should use:
|
||||
*
|
||||
* ALT_SEM(mysem)
|
||||
*
|
||||
* not:
|
||||
*
|
||||
* ALT_SEM(mysem);
|
||||
*
|
||||
* The inclusion of the semi-colon has been necessary to ensure the macros can
|
||||
* compile with no warnings when used in a single threaded HAL environment.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "priv/alt_no_error.h"
|
||||
|
||||
#define ALT_SEM(sem)
|
||||
#define ALT_EXTERN_SEM(sem)
|
||||
#define ALT_STATIC_SEM(sem)
|
||||
|
||||
#define ALT_SEM_CREATE(sem, value) alt_no_error ()
|
||||
#define ALT_SEM_PEND(sem, timeout) alt_no_error ()
|
||||
#define ALT_SEM_POST(sem) alt_no_error ()
|
||||
|
||||
#ifndef ALT_SINGLE_THREADED
|
||||
#define ALT_SINGLE_THREADED
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_SEM_H__ */
|
75
software/signal_processing_bsp/HAL/inc/os/alt_syscall.h
Normal file
75
software/signal_processing_bsp/HAL/inc/os/alt_syscall.h
Normal file
@ -0,0 +1,75 @@
|
||||
#ifndef __ALT_SYSCALL_H__
|
||||
#define __ALT_SYSCALL_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* The macros defined in this file are used to provide the function names used
|
||||
* for the HAL 'UNIX style' interface, e.g. read(), write() etc.
|
||||
*
|
||||
* Operating systems which are ported to the HAL can provide their own
|
||||
* version of this file, which will be used in preference. This allows
|
||||
* the operating system to provide it's own implementation of the top level
|
||||
* system calls, while retaining the HAL functions under a different name,
|
||||
* for example, alt_read(), alt_write() etc.
|
||||
*/
|
||||
|
||||
#define ALT_CLOSE close
|
||||
#define ALT_ENVIRON environ
|
||||
#define ALT_EXECVE execve
|
||||
#define ALT_EXIT _exit
|
||||
#define ALT_FCNTL fcntl
|
||||
#define ALT_FORK fork
|
||||
#define ALT_FSTAT fstat
|
||||
#define ALT_GETPID getpid
|
||||
#define ALT_GETTIMEOFDAY gettimeofday
|
||||
#define ALT_IOCTL ioctl
|
||||
#define ALT_ISATTY isatty
|
||||
#define ALT_KILL kill
|
||||
#define ALT_LINK link
|
||||
#define ALT_LSEEK lseek
|
||||
#define ALT_OPEN open
|
||||
#define ALT_READ read
|
||||
#define ALT_RENAME _rename
|
||||
#define ALT_SBRK sbrk
|
||||
#define ALT_SETTIMEOFDAY settimeofday
|
||||
#define ALT_STAT stat
|
||||
#define ALT_UNLINK unlink
|
||||
#define ALT_USLEEP usleep
|
||||
#define ALT_WAIT wait
|
||||
#define ALT_WRITE write
|
||||
#define ALT_TIMES times
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#endif /* __ALT_SYSCALL_H__ */
|
99
software/signal_processing_bsp/HAL/inc/priv/alt_alarm.h
Normal file
99
software/signal_processing_bsp/HAL/inc/priv/alt_alarm.h
Normal file
@ -0,0 +1,99 @@
|
||||
#ifndef __ALT_PRIV_ALARM_H__
|
||||
#define __ALT_PRIV_ALARM_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2017,2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
/*
|
||||
* This header provides the internal definitions required by the public
|
||||
* interface alt_alarm.h. These variables and structures are not guaranteed to
|
||||
* exist in future implementations of the HAL.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* "alt_alarm_s" is a structure type used to maintain lists of alarm callback
|
||||
* functions.
|
||||
*/
|
||||
|
||||
struct alt_alarm_s
|
||||
{
|
||||
alt_llist llist; /* linked list */
|
||||
alt_u64 time; /* time in system ticks of the callback */
|
||||
alt_u32 (*callback) (void* context); /* callback function. The return
|
||||
* value is the period for the next callback; where
|
||||
* zero indicates that the alarm should be removed
|
||||
* from the list.
|
||||
*/
|
||||
void* context; /* Argument for the callback */
|
||||
};
|
||||
|
||||
/*
|
||||
* "_alt_tick_rate" is a global variable used to store the system clock rate
|
||||
* in ticks per second. This is initialised to zero, which coresponds to there
|
||||
* being no system clock available.
|
||||
*
|
||||
* It is then set to it's final value by the system clock driver through a call
|
||||
* to alt_sysclk_init().
|
||||
*/
|
||||
|
||||
extern alt_u32 _alt_tick_rate;
|
||||
|
||||
/*
|
||||
* "_alt_nticks" is a global variable which records the elapsed number of
|
||||
* system clock ticks since the last call to settimeofday() or since reset if
|
||||
* settimeofday() has not been called.
|
||||
*/
|
||||
|
||||
extern volatile alt_u64 _alt_nticks;
|
||||
|
||||
/* The list of registered alarms. */
|
||||
|
||||
extern alt_llist alt_alarm_list;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_PRIV_ALARM_H__ */
|
35
software/signal_processing_bsp/HAL/inc/priv/alt_busy_sleep.h
Normal file
35
software/signal_processing_bsp/HAL/inc/priv/alt_busy_sleep.h
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef __ALT_BUSY_SLEEP_H
|
||||
#define __ALT_BUSY_SLEEP_H
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Altera Corporation, San Jose, California, USA.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The function alt_busy_sleep provides a busy loop implementation of usleep.
|
||||
* This is used to provide usleep for the standalone HAL, or when the timer is
|
||||
* unavailable in uC/OS-II.
|
||||
*/
|
||||
|
||||
extern unsigned int alt_busy_sleep (unsigned int us);
|
||||
|
||||
#endif /* __ALT_BUSY_SLEEP_H */
|
77
software/signal_processing_bsp/HAL/inc/priv/alt_dev_llist.h
Normal file
77
software/signal_processing_bsp/HAL/inc/priv/alt_dev_llist.h
Normal file
@ -0,0 +1,77 @@
|
||||
#ifndef __ALT_DEV_LLIST_H__
|
||||
#define __ALT_DEV_LLIST_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "sys/alt_llist.h"
|
||||
#include "alt_types.h"
|
||||
|
||||
/*
|
||||
* This header provides the internal defenitions required to control file
|
||||
* access. These variables and functions are not guaranteed to exist in
|
||||
* future implementations of the HAL.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* The alt_dev_llist is an internal structure used to form a common base
|
||||
* class for all device types. The use of this structure allows common code
|
||||
* to be used to manipulate the various device lists.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
alt_llist llist;
|
||||
const char* name;
|
||||
} alt_dev_llist;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
extern int alt_dev_llist_insert (alt_dev_llist* dev, alt_llist* list);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_DEV_LLIST_H__ */
|
@ -0,0 +1,39 @@
|
||||
#ifndef __ALT_EXCEPTION_HANDLER_REGISTRY_H__
|
||||
#define __ALT_EXCEPTION_HANDLER_REGISTRY_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
#include "sys/alt_exceptions.h"
|
||||
|
||||
/* Function pointer to exception callback routine */
|
||||
extern alt_exception_result (*alt_instruction_exception_handler)
|
||||
(alt_exception_cause, alt_u32, alt_u32);
|
||||
|
||||
#endif /* __ALT_EXCEPTION_HANDLER_REGISTRY_H__ */
|
179
software/signal_processing_bsp/HAL/inc/priv/alt_file.h
Normal file
179
software/signal_processing_bsp/HAL/inc/priv/alt_file.h
Normal file
@ -0,0 +1,179 @@
|
||||
#ifndef __ALT_FILE_H__
|
||||
#define __ALT_FILE_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "sys/alt_dev.h"
|
||||
#include "sys/alt_llist.h"
|
||||
#include "os/alt_sem.h"
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
/*
|
||||
* This header provides the internal defenitions required to control file
|
||||
* access. These variables and functions are not guaranteed to exist in
|
||||
* future implementations of the HAL.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* The function alt_find_dev() is used to search the device list "list" to
|
||||
* locate a device named "name". If a match is found, then a pointer to the
|
||||
* device is returned, otherwise NULL is returned.
|
||||
*/
|
||||
|
||||
extern alt_dev* alt_find_dev (const char* name, alt_llist* list);
|
||||
|
||||
/*
|
||||
* alt_find_file() is used to search the list of registered file systems to
|
||||
* find the filesystem that the file named "name" belongs to. If a match is
|
||||
* found, then a pointer to the filesystems alt_dev structure is returned,
|
||||
* otherwise NULL is returned.
|
||||
*
|
||||
* Note that a match does not indicate that the file exists, only that a
|
||||
* filesystem exists that is registered for a partition that could contain
|
||||
* the file. The filesystems open() function would need to be called in order
|
||||
* to determine if the file exists.
|
||||
*/
|
||||
|
||||
extern alt_dev* alt_find_file (const char* name);
|
||||
|
||||
/*
|
||||
* alt_get_fd() is used to allocate a file descriptor for the device or
|
||||
* filesystem "dev". A negative return value indicates an error, otherwise the
|
||||
* return value is the index of the file descriptor within the file descriptor
|
||||
* pool.
|
||||
*/
|
||||
|
||||
extern int alt_get_fd (alt_dev* dev);
|
||||
|
||||
/*
|
||||
* alt_release_fd() is called to free the file descriptor with index "fd".
|
||||
*/
|
||||
|
||||
extern void alt_release_fd (int fd);
|
||||
|
||||
/*
|
||||
* alt_fd_lock() is called by ioctl() to mark the file descriptor "fd" as
|
||||
* being open for exclusive access. Subsequent calls to open() for the device
|
||||
* associated with "fd" will fail. A device is unlocked by either calling
|
||||
* close() for "fd", or by an alternate call to ioctl() (see ioctl.c for
|
||||
* details).
|
||||
*/
|
||||
|
||||
extern int alt_fd_lock (alt_fd* fd);
|
||||
|
||||
/*
|
||||
* alt_fd_unlock() is called by ioctl() to unlock a descriptor previously
|
||||
* locked by a call to alt_fd_lock().
|
||||
*/
|
||||
|
||||
extern int alt_fd_unlock (alt_fd* fd);
|
||||
|
||||
/*
|
||||
* "alt_fd_list" is the pool of file descriptors.
|
||||
*/
|
||||
|
||||
extern alt_fd alt_fd_list[];
|
||||
|
||||
/*
|
||||
* flags used by alt_fd.
|
||||
*
|
||||
* ALT_FD_EXCL is used to mark a file descriptor as locked for exclusive
|
||||
* access, i.e. further calls to open() for the associated device should
|
||||
* fail.
|
||||
*
|
||||
* ALT_FD_DEV marks a dile descriptor as belonging to a device as oposed to a
|
||||
* filesystem.
|
||||
*/
|
||||
|
||||
#define ALT_FD_EXCL 0x80000000
|
||||
#define ALT_FD_DEV 0x40000000
|
||||
|
||||
#define ALT_FD_FLAGS_MASK (ALT_FD_EXCL | ALT_FD_DEV)
|
||||
|
||||
/*
|
||||
* "alt_dev_list" is the head of the linked list of registered devices.
|
||||
*/
|
||||
|
||||
extern alt_llist alt_dev_list;
|
||||
|
||||
/*
|
||||
* "alt_fs_list" is the head of the linked list of registered filesystems.
|
||||
*/
|
||||
|
||||
extern alt_llist alt_fs_list;
|
||||
|
||||
/*
|
||||
* "alt_fd_list_lock" is a semaphore used to ensure that access to the pool
|
||||
* of file descriptors is thread safe.
|
||||
*/
|
||||
|
||||
ALT_EXTERN_SEM(alt_fd_list_lock)
|
||||
|
||||
/*
|
||||
* "alt_max_fd" is a 'high water mark'. It indicates the highest file
|
||||
* descriptor allocated. Use of this can save searching the entire pool
|
||||
* for active file descriptors, which helps avoid contention on access
|
||||
* to the file descriptor pool.
|
||||
*/
|
||||
|
||||
extern alt_32 alt_max_fd;
|
||||
|
||||
/*
|
||||
* alt_io_redirect() is called at startup to redirect stdout, stdin, and
|
||||
* stderr to the devices named in the input arguments. By default these streams
|
||||
* are directed at /dev/null, and are then redirected using this function once
|
||||
* all of the devices have been registered within the system.
|
||||
*/
|
||||
|
||||
extern void alt_io_redirect(const char* stdout_dev,
|
||||
const char* stdin_dev,
|
||||
const char* stderr_dev);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_FILE_H__ */
|
@ -0,0 +1,39 @@
|
||||
#ifndef __ALT_IIC_ISR_REGISTER_H_
|
||||
#define __ALT_IIC_ISR_REGISTER_H_
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
#include "alt_types.h"
|
||||
#include "sys/alt_irq.h"
|
||||
|
||||
extern int alt_iic_isr_register(alt_u32 ic_id, alt_u32 irq, alt_isr_func isr,
|
||||
void *isr_context, void *flags);
|
||||
|
||||
#endif /* __ALT_IIC_ISR_REGISTER_H_ */
|
59
software/signal_processing_bsp/HAL/inc/priv/alt_irq_table.h
Normal file
59
software/signal_processing_bsp/HAL/inc/priv/alt_irq_table.h
Normal file
@ -0,0 +1,59 @@
|
||||
#ifndef __ALT_IRQ_TABLE_H__
|
||||
#define __ALT_IRQ_TABLE_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Definition of a table describing each interrupt handler. The index into
|
||||
* the array is the interrupt id associated with the handler.
|
||||
*
|
||||
* When an interrupt occurs, the associated handler is called with
|
||||
* the argument stored in the context member.
|
||||
*
|
||||
* The table is physically created in alt_irq_handler.c
|
||||
*/
|
||||
extern struct ALT_IRQ_HANDLER
|
||||
{
|
||||
#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT
|
||||
void (*handler)(void*);
|
||||
#else
|
||||
void (*handler)(void*, alt_u32);
|
||||
#endif
|
||||
void *context;
|
||||
} alt_irq[ALT_NIRQ];
|
||||
|
||||
#endif
|
158
software/signal_processing_bsp/HAL/inc/priv/alt_legacy_irq.h
Normal file
158
software/signal_processing_bsp/HAL/inc/priv/alt_legacy_irq.h
Normal file
@ -0,0 +1,158 @@
|
||||
#ifndef __ALT_LEGACY_IRQ_H__
|
||||
#define __ALT_LEGACY_IRQ_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* This file provides prototypes and inline implementations of certain routines
|
||||
* used by the legacy interrupt API. Do not include this in your driver or
|
||||
* application source files, use "sys/alt_irq.h" instead to access the proper
|
||||
* public API.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include "system.h"
|
||||
|
||||
#ifndef NIOS2_EIC_PRESENT
|
||||
|
||||
#include "nios2.h"
|
||||
#include "alt_types.h"
|
||||
|
||||
#include "sys/alt_irq.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* alt_irq_register() can be used to register an interrupt handler. If the
|
||||
* function is succesful, then the requested interrupt will be enabled upon
|
||||
* return.
|
||||
*/
|
||||
extern int alt_irq_register (alt_u32 id,
|
||||
void* context,
|
||||
alt_isr_func handler);
|
||||
|
||||
/*
|
||||
* alt_irq_disable() disables the individual interrupt indicated by "id".
|
||||
*/
|
||||
static ALT_INLINE int ALT_ALWAYS_INLINE alt_irq_disable (alt_u32 id)
|
||||
{
|
||||
alt_irq_context status;
|
||||
extern volatile alt_u32 alt_irq_active;
|
||||
|
||||
status = alt_irq_disable_all ();
|
||||
|
||||
alt_irq_active &= ~(1 << id);
|
||||
NIOS2_WRITE_IENABLE (alt_irq_active);
|
||||
|
||||
alt_irq_enable_all(status);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_irq_enable() enables the individual interrupt indicated by "id".
|
||||
*/
|
||||
static ALT_INLINE int ALT_ALWAYS_INLINE alt_irq_enable (alt_u32 id)
|
||||
{
|
||||
alt_irq_context status;
|
||||
extern volatile alt_u32 alt_irq_active;
|
||||
|
||||
status = alt_irq_disable_all ();
|
||||
|
||||
alt_irq_active |= (1 << id);
|
||||
NIOS2_WRITE_IENABLE (alt_irq_active);
|
||||
|
||||
alt_irq_enable_all(status);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef ALT_EXCEPTION_STACK
|
||||
/*
|
||||
* alt_irq_initerruptable() should only be called from within an ISR. It is used
|
||||
* to allow higer priority interrupts to interrupt the current ISR. The input
|
||||
* argument, "priority", is the priority, i.e. interrupt number of the current
|
||||
* interrupt.
|
||||
*
|
||||
* If this function is called, then the ISR is required to make a call to
|
||||
* alt_irq_non_interruptible() before returning. The input argument to
|
||||
* alt_irq_non_interruptible() is the return value from alt_irq_interruptible().
|
||||
*
|
||||
* Care should be taken when using this pair of functions, since they increasing
|
||||
* the system overhead associated with interrupt handling.
|
||||
*
|
||||
* If you are using an exception stack then nested interrupts won't work, so
|
||||
* these functions are not available in that case.
|
||||
*/
|
||||
static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_irq_interruptible (alt_u32 priority)
|
||||
{
|
||||
extern volatile alt_u32 alt_priority_mask;
|
||||
extern volatile alt_u32 alt_irq_active;
|
||||
|
||||
alt_u32 old_priority;
|
||||
|
||||
old_priority = alt_priority_mask;
|
||||
alt_priority_mask = (1 << priority) - 1;
|
||||
|
||||
NIOS2_WRITE_IENABLE (alt_irq_active & alt_priority_mask);
|
||||
|
||||
NIOS2_WRITE_STATUS (1);
|
||||
|
||||
return old_priority;
|
||||
}
|
||||
|
||||
/*
|
||||
* See Comments above for alt_irq_interruptible() for an explanation of the use of this
|
||||
* function.
|
||||
*/
|
||||
static ALT_INLINE void ALT_ALWAYS_INLINE alt_irq_non_interruptible (alt_u32 mask)
|
||||
{
|
||||
extern volatile alt_u32 alt_priority_mask;
|
||||
extern volatile alt_u32 alt_irq_active;
|
||||
|
||||
NIOS2_WRITE_STATUS (0);
|
||||
|
||||
alt_priority_mask = mask;
|
||||
|
||||
NIOS2_WRITE_IENABLE (mask & alt_irq_active);
|
||||
}
|
||||
#endif /* ALT_EXCEPTION_STACK */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* NIOS2_EIC_PRESENT */
|
||||
|
||||
#endif /* __ALT_LEGACY_IRQ_H__ */
|
77
software/signal_processing_bsp/HAL/inc/priv/alt_no_error.h
Normal file
77
software/signal_processing_bsp/HAL/inc/priv/alt_no_error.h
Normal file
@ -0,0 +1,77 @@
|
||||
#ifndef __ALT_NO_ERROR_H__
|
||||
#define __ALT_NO_ERROR_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* alt_no_error() is a dummy function used by alt_sem.h and alt_flag.h. It
|
||||
* substitutes for functions that have a return code by creating a function
|
||||
* that always returns zero.
|
||||
*
|
||||
* This may seem a little obscure, but what happens is that the compiler can
|
||||
* then optomise away the call to this function, and any code written which
|
||||
* handles the error path (i.e. non zero return values).
|
||||
*
|
||||
* This allows code to be written which correctly use the uC/OS-II semaphore
|
||||
* and flag utilities, without the use of those utilities impacting on
|
||||
* excutables built for a single threaded HAL environment.
|
||||
*
|
||||
* This function is considered to be part of the internal implementation of
|
||||
* the HAL, and should not be called directly by application code or device
|
||||
* drivers. It is not guaranteed to be preserved in future versions of the
|
||||
* HAL.
|
||||
*/
|
||||
|
||||
static ALT_INLINE int ALT_ALWAYS_INLINE alt_no_error (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_NO_ERROR_H__ */
|
@ -0,0 +1,47 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
#ifndef NIOS2_GMON_DATA_H
|
||||
#define NIOS2_GMON_DATA_H
|
||||
|
||||
#define GMON_DATA_SIG 0
|
||||
#define GMON_DATA_WORDS 1
|
||||
#define GMON_DATA_PROFILE_DATA 2
|
||||
#define GMON_DATA_PROFILE_LOWPC 3
|
||||
#define GMON_DATA_PROFILE_HIGHPC 4
|
||||
#define GMON_DATA_PROFILE_BUCKET 5
|
||||
#define GMON_DATA_PROFILE_RATE 6
|
||||
#define GMON_DATA_MCOUNT_START 7
|
||||
#define GMON_DATA_MCOUNT_LIMIT 8
|
||||
|
||||
#define GMON_DATA_SIZE 9
|
||||
|
||||
extern unsigned int alt_gmon_data[GMON_DATA_SIZE];
|
||||
|
||||
#endif
|
126
software/signal_processing_bsp/HAL/inc/sys/alt_alarm.h
Normal file
126
software/signal_processing_bsp/HAL/inc/sys/alt_alarm.h
Normal file
@ -0,0 +1,126 @@
|
||||
#ifndef __ALT_ALARM_H__
|
||||
#define __ALT_ALARM_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2017,2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "alt_llist.h"
|
||||
#include "alt_types.h"
|
||||
|
||||
#include "priv/alt_alarm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* "alt_alarm" is a structure type used by applications to register an alarm
|
||||
* callback function. An instance of this type must be passed as an input
|
||||
* argument to alt_alarm_start(). The user is not responsible for initialising
|
||||
* the contents of the instance. This is done by alt_alarm_start().
|
||||
*/
|
||||
|
||||
typedef struct alt_alarm_s alt_alarm;
|
||||
|
||||
/*
|
||||
* alt_alarm_start() can be called by an application/driver in order to register
|
||||
* a function for periodic callback at the system clock frequency. Be aware that
|
||||
* this callback is likely to occur in interrupt context.
|
||||
*/
|
||||
|
||||
extern int alt_alarm_start (alt_alarm* the_alarm,
|
||||
alt_u32 nticks,
|
||||
alt_u32 (*callback) (void* context),
|
||||
void* context);
|
||||
|
||||
/*
|
||||
* alt_alarm_stop() is used to unregister a callback. Alternatively the callback
|
||||
* can return zero to unregister.
|
||||
*/
|
||||
|
||||
extern void alt_alarm_stop (alt_alarm* the_alarm);
|
||||
|
||||
/*
|
||||
* Obtain the system clock rate in ticks/s.
|
||||
*/
|
||||
|
||||
static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_ticks_per_second (void)
|
||||
{
|
||||
return _alt_tick_rate;
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_sysclk_init() is intended to be only used by the system clock driver
|
||||
* in order to initialise the value of the clock frequency.
|
||||
*/
|
||||
|
||||
static ALT_INLINE int ALT_ALWAYS_INLINE alt_sysclk_init (alt_u32 nticks)
|
||||
{
|
||||
if (! _alt_tick_rate)
|
||||
{
|
||||
_alt_tick_rate = nticks;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_nticks() returns the elapsed number of system clock ticks since reset.
|
||||
*/
|
||||
|
||||
static ALT_INLINE alt_u64 ALT_ALWAYS_INLINE alt_nticks (void)
|
||||
{
|
||||
return _alt_nticks;
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_tick() should only be called by the system clock driver. This is used
|
||||
* to notify the system that the system timer period has expired.
|
||||
*/
|
||||
|
||||
extern void alt_tick (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_ALARM_H__ */
|
117
software/signal_processing_bsp/HAL/inc/sys/alt_cache.h
Normal file
117
software/signal_processing_bsp/HAL/inc/sys/alt_cache.h
Normal file
@ -0,0 +1,117 @@
|
||||
#ifndef __ALT_CACHE_H__
|
||||
#define __ALT_CACHE_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003, 2007 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
/*
|
||||
* alt_cache.h defines the processor specific functions for manipulating the
|
||||
* cache.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* alt_icache_flush() is called to flush the instruction cache for a memory
|
||||
* region of length "len" bytes, starting at address "start".
|
||||
*/
|
||||
|
||||
extern void alt_icache_flush (void* start, alt_u32 len);
|
||||
|
||||
/*
|
||||
* alt_dcache_flush() is called to flush the data cache for a memory
|
||||
* region of length "len" bytes, starting at address "start".
|
||||
* Any dirty lines in the data cache are written back to memory.
|
||||
*/
|
||||
|
||||
extern void alt_dcache_flush (void* start, alt_u32 len);
|
||||
|
||||
/*
|
||||
* alt_dcache_flush() is called to flush the data cache for a memory
|
||||
* region of length "len" bytes, starting at address "start".
|
||||
* Any dirty lines in the data cache are NOT written back to memory.
|
||||
*/
|
||||
|
||||
extern void alt_dcache_flush_no_writeback (void* start, alt_u32 len);
|
||||
|
||||
/*
|
||||
* Flush the entire instruction cache.
|
||||
*/
|
||||
|
||||
extern void alt_icache_flush_all (void);
|
||||
|
||||
/*
|
||||
* Flush the entire data cache.
|
||||
*/
|
||||
|
||||
extern void alt_dcache_flush_all (void);
|
||||
|
||||
/*
|
||||
* Allocate a block of uncached memory.
|
||||
*/
|
||||
|
||||
extern volatile void* alt_uncached_malloc (size_t size);
|
||||
|
||||
/*
|
||||
* Free a block of uncached memory.
|
||||
*/
|
||||
|
||||
extern void alt_uncached_free (volatile void* ptr);
|
||||
|
||||
/*
|
||||
* Convert a pointer to a block of cached memory, into a block of
|
||||
* uncached memory.
|
||||
*/
|
||||
|
||||
extern volatile void* alt_remap_uncached (void* ptr, alt_u32 len);
|
||||
|
||||
/*
|
||||
* Convert a pointer to a block of uncached memory, into a block of
|
||||
* cached memory.
|
||||
*/
|
||||
|
||||
extern void* alt_remap_cached (volatile void* ptr, alt_u32 len);
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_CACHE_H__ */
|
45
software/signal_processing_bsp/HAL/inc/sys/alt_debug.h
Normal file
45
software/signal_processing_bsp/HAL/inc/sys/alt_debug.h
Normal file
@ -0,0 +1,45 @@
|
||||
#ifndef __ALT_DEBUG_H__
|
||||
#define __ALT_DEBUG_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* The ALT_DEVUG_ASSERT macro can be used to generate a debugger break
|
||||
* from within software. The break is generated if "condition" evaluates to
|
||||
* false.
|
||||
*/
|
||||
|
||||
#define ALT_DEBUG_ASSERT(condition) if (!condition) \
|
||||
{ \
|
||||
__asm__ volatile ("break"); \
|
||||
}
|
||||
|
||||
#endif /* __ALT_DEBUG_H__ */
|
115
software/signal_processing_bsp/HAL/inc/sys/alt_dev.h
Normal file
115
software/signal_processing_bsp/HAL/inc/sys/alt_dev.h
Normal file
@ -0,0 +1,115 @@
|
||||
#ifndef __ALT_DEV_H__
|
||||
#define __ALT_DEV_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "system.h"
|
||||
#include "sys/alt_llist.h"
|
||||
#include "priv/alt_dev_llist.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* The value ALT_IRQ_NOT_CONNECTED is used to represent an unconnected
|
||||
* interrupt line. It cannot evaluate to a valid interrupt number.
|
||||
*/
|
||||
|
||||
#define ALT_IRQ_NOT_CONNECTED (-1)
|
||||
|
||||
typedef struct alt_dev_s alt_dev;
|
||||
|
||||
struct stat;
|
||||
|
||||
/*
|
||||
* The file descriptor structure definition.
|
||||
*/
|
||||
|
||||
typedef struct alt_fd_s
|
||||
{
|
||||
alt_dev* dev;
|
||||
alt_u8* priv;
|
||||
int fd_flags;
|
||||
} alt_fd;
|
||||
|
||||
/*
|
||||
* The device structure definition.
|
||||
*/
|
||||
|
||||
struct alt_dev_s {
|
||||
alt_llist llist; /* for internal use */
|
||||
const char* name;
|
||||
int (*open) (alt_fd* fd, const char* name, int flags, int mode);
|
||||
int (*close) (alt_fd* fd);
|
||||
int (*read) (alt_fd* fd, char* ptr, int len);
|
||||
int (*write) (alt_fd* fd, const char* ptr, int len);
|
||||
int (*lseek) (alt_fd* fd, int ptr, int dir);
|
||||
int (*fstat) (alt_fd* fd, struct stat* buf);
|
||||
int (*ioctl) (alt_fd* fd, int req, void* arg);
|
||||
};
|
||||
|
||||
/*
|
||||
* Functions used to register device for access through the C standard
|
||||
* library.
|
||||
*
|
||||
* The only difference between alt_dev_reg() and alt_fs_reg() is the
|
||||
* interpretation that open() places on the device name. In the case of
|
||||
* alt_dev_reg the device is assumed to be a particular character device,
|
||||
* and so there must be an exact match in the name for open to succeed.
|
||||
* In the case of alt_fs_reg() the name of the device is treated as the
|
||||
* mount point for a directory, and so any call to open() where the name
|
||||
* is the root of the device filename will succeed.
|
||||
*/
|
||||
|
||||
extern int alt_fs_reg (alt_dev* dev);
|
||||
|
||||
static ALT_INLINE int alt_dev_reg (alt_dev* dev)
|
||||
{
|
||||
extern alt_llist alt_dev_list;
|
||||
|
||||
return alt_dev_llist_insert ((alt_dev_llist*) dev, &alt_dev_list);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_DEV_H__ */
|
226
software/signal_processing_bsp/HAL/inc/sys/alt_dma.h
Normal file
226
software/signal_processing_bsp/HAL/inc/sys/alt_dma.h
Normal file
@ -0,0 +1,226 @@
|
||||
#ifndef __ALT_DMA_H__
|
||||
#define __ALT_DMA_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004-2005 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "sys/alt_dma_dev.h"
|
||||
#include "alt_types.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* This header contains the application side interface for accessing DMA
|
||||
* resources. See alt_dma_dev.h for the dma device driver interface.
|
||||
*
|
||||
* The interface model treats a DMA transaction as being composed of two
|
||||
* halves (read and write).
|
||||
*
|
||||
* The application can supply data for transmit using an "alt_dma_txchan"
|
||||
* descriptor. Alternatively an "alt_dma_rxchan" descriptor can be used to
|
||||
* receive data.
|
||||
*/
|
||||
|
||||
/*
|
||||
* alt_dma_txchan_open() is used to obtain an "alt_dma_txchan" descriptor for
|
||||
* a DMA transmit device. The name is the name of the associated physical
|
||||
* device (e.g. "/dev/dma_0").
|
||||
*
|
||||
* The return value will be NULL on failure, and non-NULL otherwise.
|
||||
*/
|
||||
|
||||
extern alt_dma_txchan alt_dma_txchan_open (const char* name);
|
||||
|
||||
/*
|
||||
* alt_dma_txchan_close() is provided so that an application can notify the
|
||||
* system that it has finished with a given DMA transmit channel. This is only
|
||||
* provided for completness.
|
||||
*/
|
||||
|
||||
static ALT_INLINE int alt_dma_txchan_close (alt_dma_txchan dma)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_dma_txchan_send() posts a transmit request to a DMA transmit channel.
|
||||
* The input arguments are:
|
||||
*
|
||||
* dma: the channel to use.
|
||||
* from: a pointer to the start of the data to send.
|
||||
* length: the length of the data to send in bytes.
|
||||
* done: callback function that will be called once the data has been sent.
|
||||
* handle: opaque value passed to "done".
|
||||
*
|
||||
* The return value will be negative if the request cannot be posted, and
|
||||
* zero otherwise.
|
||||
*/
|
||||
|
||||
static ALT_INLINE int alt_dma_txchan_send (alt_dma_txchan dma,
|
||||
const void* from,
|
||||
alt_u32 length,
|
||||
alt_txchan_done* done,
|
||||
void* handle)
|
||||
{
|
||||
return dma ? dma->dma_send (dma,
|
||||
from,
|
||||
length,
|
||||
done,
|
||||
handle) : -ENODEV;
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_dma_txchan_space() returns the number of tranmit requests that can be
|
||||
* posted to the specified DMA transmit channel.
|
||||
*
|
||||
* A negative value indicates that the value could not be determined.
|
||||
*/
|
||||
|
||||
static ALT_INLINE int alt_dma_txchan_space (alt_dma_txchan dma)
|
||||
{
|
||||
return dma ? dma->space (dma) : -ENODEV;
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_dma_txchan_ioctl() can be used to perform device specific I/O
|
||||
* operations on the indicated DMA transmit channel. For example some drivers
|
||||
* support options to control the width of the transfer operations. See
|
||||
* alt_dma_dev.h for the list of generic requests.
|
||||
*
|
||||
* A negative return value indicates failure, otherwise the interpretation
|
||||
* of the return value is request specific.
|
||||
*/
|
||||
|
||||
static ALT_INLINE int alt_dma_txchan_ioctl (alt_dma_txchan dma,
|
||||
int req,
|
||||
void* arg)
|
||||
{
|
||||
return dma ? dma->ioctl (dma, req, arg) : -ENODEV;
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_dma_rxchan_open() is used to obtain an "alt_dma_rxchan" descriptor for
|
||||
* a DMA receive channel. The name is the name of the associated physical
|
||||
* device (e.g. "/dev/dma_0").
|
||||
*
|
||||
* The return value will be NULL on failure, and non-NULL otherwise.
|
||||
*/
|
||||
|
||||
extern alt_dma_rxchan alt_dma_rxchan_open (const char* dev);
|
||||
|
||||
/*
|
||||
* alt_dma_rxchan_close() is provided so that an application can notify the
|
||||
* system that it has finished with a given DMA receive channel. This is only
|
||||
* provided for completness.
|
||||
*/
|
||||
|
||||
static ALT_INLINE int alt_dma_rxchan_close (alt_dma_rxchan dma)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* alt_dma_rxchan_prepare() posts a receive request to a DMA receive channel.
|
||||
*
|
||||
* The input arguments are:
|
||||
*
|
||||
* dma: the channel to use.
|
||||
* data: a pointer to the location that data is to be received to.
|
||||
* len: the maximum length of the data to receive.
|
||||
* done: callback function that will be called once the data has been
|
||||
* received.
|
||||
* handle: opaque value passed to "done".
|
||||
*
|
||||
* The return value will be negative if the request cannot be posted, and
|
||||
* zero otherwise.
|
||||
*/
|
||||
|
||||
static ALT_INLINE int alt_dma_rxchan_prepare (alt_dma_rxchan dma,
|
||||
void* data,
|
||||
alt_u32 len,
|
||||
alt_rxchan_done* done,
|
||||
void* handle)
|
||||
{
|
||||
return dma ? dma->prepare (dma, data, len, done, handle) : -ENODEV;
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_dma_rxchan_ioctl() can be used to perform device specific I/O
|
||||
* operations on the indicated DMA receive channel. For example some drivers
|
||||
* support options to control the width of the transfer operations. See
|
||||
* alt_dma_dev.h for the list of generic requests.
|
||||
*
|
||||
* A negative return value indicates failure, otherwise the interpretation
|
||||
* of the return value is request specific.
|
||||
*/
|
||||
|
||||
static ALT_INLINE int alt_dma_rxchan_ioctl (alt_dma_rxchan dma,
|
||||
int req,
|
||||
void* arg)
|
||||
{
|
||||
return dma ? dma->ioctl (dma, req, arg) : -ENODEV;
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_dma_rxchan_depth() returns the depth of the receive FIFO used to store
|
||||
* receive requests.
|
||||
*/
|
||||
|
||||
static ALT_INLINE alt_u32 alt_dma_rxchan_depth(alt_dma_rxchan dma)
|
||||
{
|
||||
return dma->depth;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __ALT_DMA_H__ */
|
200
software/signal_processing_bsp/HAL/inc/sys/alt_dma_dev.h
Normal file
200
software/signal_processing_bsp/HAL/inc/sys/alt_dma_dev.h
Normal file
@ -0,0 +1,200 @@
|
||||
#ifndef __ALT_DMA_DEV_H__
|
||||
#define __ALT_DMA_DEV_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004-2005 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "priv/alt_dev_llist.h"
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* This header contains the device driver interface for accessing DMA
|
||||
* resources. See alt_dma.h for the DMA application side interface.
|
||||
*
|
||||
* The interface model treats a DMA transaction as being composed of two
|
||||
* halves (read and write).
|
||||
*
|
||||
* An "alt_dma_txchan_dev" is used to describe the device associated with a
|
||||
* DMA transmit channel. An "alt_dma_rxchan_dev" is used to describe the
|
||||
* device associated with a DMA receive channel.
|
||||
*/
|
||||
|
||||
/*
|
||||
* List of generic ioctl requests that may be supported by a DMA device.
|
||||
*
|
||||
* ALT_DMA_RX_ONLY_ON: This causes a DMA channel to operate in a mode
|
||||
* where only the receiver is under software control.
|
||||
* The other side reads continously from a single
|
||||
* location. The address to read is the argument to
|
||||
* this request.
|
||||
* ALT_DMA_RX_ONLY_OFF: Return to the default mode where both the receive
|
||||
* and transmit sides of the DMA can be under software
|
||||
* control.
|
||||
* ALT_DMA_TX_ONLY_ON: This causes a DMA channel to operate in a mode
|
||||
* where only the transmitter is under software control.
|
||||
* The other side writes continously to a single
|
||||
* location. The address to write to is the argument to
|
||||
* this request.
|
||||
* ALT_DMA_TX_ONLY_OFF: Return to the default mode where both the receive
|
||||
* and transmit sides of the DMA can be under software
|
||||
* control.
|
||||
* ALT_DMA_SET_MODE_8: Transfer data in units of 8 bits.
|
||||
* ALT_DMA_SET_MODE_16: Transfer data in units of 16 bits.
|
||||
* ALT_DMA_SET_MODE_32: Transfer data in units of 32 bits.
|
||||
* ALT_DMA_SET_MODE_64: Transfer data in units of 64 bits.
|
||||
* ALT_DMA_SET_MODE_128: Transfer data in units of 128 bits.
|
||||
* ALT_DMA_GET_MODE: Get the current transfer mode.
|
||||
*
|
||||
* The use of the macros: ALT_DMA_TX_STREAM_ON, ALT_DMA_TX_STREAM_OFF
|
||||
* ALT_DMA_RX_STREAM_OFF and ALT_DMA_RX_STREAM_ON are depreciated. You should
|
||||
* instead use the macros: ALT_DMA_RX_ONLY_ON, ALT_DMA_RX_ONLY_OFF,
|
||||
* ALT_DMA_TX_ONLY_ON and ALT_DMA_TX_ONLY_OFF.
|
||||
*/
|
||||
|
||||
#define ALT_DMA_TX_STREAM_ON (0x1)
|
||||
#define ALT_DMA_TX_STREAM_OFF (0x2)
|
||||
#define ALT_DMA_RX_STREAM_ON (0x3)
|
||||
#define ALT_DMA_RX_STREAM_OFF (0x4)
|
||||
#define ALT_DMA_SET_MODE_8 (0x5)
|
||||
#define ALT_DMA_SET_MODE_16 (0x6)
|
||||
#define ALT_DMA_SET_MODE_32 (0x7)
|
||||
#define ALT_DMA_SET_MODE_64 (0x8)
|
||||
#define ALT_DMA_SET_MODE_128 (0x9)
|
||||
#define ALT_DMA_GET_MODE (0xa)
|
||||
|
||||
#define ALT_DMA_RX_ONLY_ON ALT_DMA_TX_STREAM_ON
|
||||
#define ALT_DMA_RX_ONLY_OFF ALT_DMA_TX_STREAM_OFF
|
||||
#define ALT_DMA_TX_ONLY_ON ALT_DMA_RX_STREAM_ON
|
||||
#define ALT_DMA_TX_ONLY_OFF ALT_DMA_RX_STREAM_OFF
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct alt_dma_txchan_dev_s alt_dma_txchan_dev;
|
||||
typedef struct alt_dma_rxchan_dev_s alt_dma_rxchan_dev;
|
||||
|
||||
typedef alt_dma_txchan_dev* alt_dma_txchan;
|
||||
typedef alt_dma_rxchan_dev* alt_dma_rxchan;
|
||||
|
||||
typedef void (alt_txchan_done)(void* handle);
|
||||
typedef void (alt_rxchan_done)(void* handle, void* data);
|
||||
|
||||
/*
|
||||
* devices that provide a DMA transmit channel are required to provide an
|
||||
* instance of the "alt_dma_txchan_dev" structure.
|
||||
*/
|
||||
|
||||
struct alt_dma_txchan_dev_s {
|
||||
alt_llist llist; /* for internal use */
|
||||
const char* name; /* name of the device instance
|
||||
* (e.g. "/dev/dma_0").
|
||||
*/
|
||||
int (*space) (alt_dma_txchan dma); /* returns the maximum number of
|
||||
* transmit requests that can be posted
|
||||
*/
|
||||
int (*dma_send) (alt_dma_txchan dma,
|
||||
const void* from,
|
||||
alt_u32 len,
|
||||
alt_txchan_done* done,
|
||||
void* handle); /* post a transmit request */
|
||||
int (*ioctl) (alt_dma_txchan dma, int req, void* arg); /* perform device
|
||||
* specific I/O control.
|
||||
*/
|
||||
};
|
||||
|
||||
/*
|
||||
* devices that provide a DMA receive channel are required to provide an
|
||||
* instance of the "alt_dma_rxchan_dev" structure.
|
||||
*/
|
||||
|
||||
struct alt_dma_rxchan_dev_s {
|
||||
alt_llist list; /* for internal use */
|
||||
const char* name; /* name of the device instance
|
||||
* (e.g. "/dev/dma_0").
|
||||
*/
|
||||
alt_u32 depth; /* maximum number of receive requests that
|
||||
* can be posted.
|
||||
*/
|
||||
int (*prepare) (alt_dma_rxchan dma,
|
||||
void* data,
|
||||
alt_u32 len,
|
||||
alt_rxchan_done* done,
|
||||
void* handle); /* post a receive request */
|
||||
int (*ioctl) (alt_dma_rxchan dma, int req, void* arg); /* perform device
|
||||
* specific I/O control.
|
||||
*/
|
||||
};
|
||||
|
||||
/*
|
||||
* Register a DMA transmit channel with the system.
|
||||
*/
|
||||
|
||||
static ALT_INLINE int alt_dma_txchan_reg (alt_dma_txchan_dev* dev)
|
||||
{
|
||||
extern alt_llist alt_dma_txchan_list;
|
||||
|
||||
return alt_dev_llist_insert((alt_dev_llist*) dev, &alt_dma_txchan_list);
|
||||
}
|
||||
|
||||
/*
|
||||
* Register a DMA receive channel with the system.
|
||||
*/
|
||||
|
||||
static ALT_INLINE int alt_dma_rxchan_reg (alt_dma_rxchan_dev* dev)
|
||||
{
|
||||
extern alt_llist alt_dma_rxchan_list;
|
||||
|
||||
return alt_dev_llist_insert((alt_dev_llist*) dev, &alt_dma_rxchan_list);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __ALT_DMA_DEV_H__ */
|
168
software/signal_processing_bsp/HAL/inc/sys/alt_driver.h
Normal file
168
software/signal_processing_bsp/HAL/inc/sys/alt_driver.h
Normal file
@ -0,0 +1,168 @@
|
||||
#ifndef __ALT_DRIVER_H__
|
||||
#define __ALT_DRIVER_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Macros used to access a driver without HAL file descriptors.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ALT_MODULE_CLASS
|
||||
*
|
||||
* This macro returns the module class name for the specified module instance.
|
||||
* It uses information in the system.h file.
|
||||
* Neither the instance name or class name are quoted (so that they can
|
||||
* be used with other pre-processor macros).
|
||||
*
|
||||
* Example:
|
||||
* Assume the design has an instance of an altera_avalon_uart called uart1.
|
||||
* Calling ALT_MODULE_CLASS(uart1) returns altera_avalon_uart.
|
||||
*/
|
||||
|
||||
#define ALT_MODULE_CLASS(instance) ALT_MODULE_CLASS_ ## instance
|
||||
|
||||
|
||||
/*
|
||||
* ALT_DRIVER_FUNC_NAME
|
||||
*
|
||||
* --> instance Instance name.
|
||||
* --> func Function name.
|
||||
*
|
||||
* This macro returns the device driver function name of the specified
|
||||
* module instance for the specified function name.
|
||||
*
|
||||
* Example:
|
||||
* Assume the design has an instance of an altera_avalon_uart called uart1.
|
||||
* Calling ALT_DRIVER_FUNC_NAME(uart1, write) returns
|
||||
* altera_avalon_uart_write.
|
||||
*/
|
||||
|
||||
#define ALT_DRIVER_FUNC_NAME(instance, func) \
|
||||
ALT_DRIVER_FUNC_NAME1(ALT_MODULE_CLASS(instance), func)
|
||||
#define ALT_DRIVER_FUNC_NAME1(module_class, func) \
|
||||
ALT_DRIVER_FUNC_NAME2(module_class, func)
|
||||
#define ALT_DRIVER_FUNC_NAME2(module_class, func) \
|
||||
module_class ## _ ## func
|
||||
|
||||
/*
|
||||
* ALT_DRIVER_STATE_STRUCT
|
||||
*
|
||||
* --> instance Instance name.
|
||||
*
|
||||
* This macro returns the device driver state type name of the specified
|
||||
* module instance.
|
||||
*
|
||||
* Example:
|
||||
* Assume the design has an instance of an altera_avalon_uart called uart1.
|
||||
* Calling ALT_DRIVER_STATE_STRUCT(uart1) returns:
|
||||
* struct altera_avalon_uart_state_s
|
||||
*
|
||||
* Note that the ALT_DRIVER_FUNC_NAME macro is used even though "state" isn't
|
||||
* really a function but it does match the required naming convention.
|
||||
*/
|
||||
#define ALT_DRIVER_STATE_STRUCT(instance) \
|
||||
struct ALT_DRIVER_FUNC_NAME(instance, state_s)
|
||||
|
||||
/*
|
||||
* ALT_DRIVER_STATE
|
||||
*
|
||||
* --> instance Instance name.
|
||||
*
|
||||
* This macro returns the device driver state name of the specified
|
||||
* module instance.
|
||||
*
|
||||
* Example:
|
||||
* Assume the design has an instance of an altera_avalon_uart called uart1.
|
||||
* Calling ALT_DRIVER_STATE(uart1) returns uart1.
|
||||
*/
|
||||
#define ALT_DRIVER_STATE(instance) instance
|
||||
|
||||
/*
|
||||
* ALT_DRIVER_WRITE
|
||||
*
|
||||
* --> instance Instance name.
|
||||
* --> buffer Write buffer.
|
||||
* --> len Length of write buffer data.
|
||||
* --> flags Control flags (e.g. O_NONBLOCK)
|
||||
*
|
||||
* This macro calls the "write" function of the specified driver instance.
|
||||
*/
|
||||
|
||||
#define ALT_DRIVER_WRITE_EXTERNS(instance) \
|
||||
extern ALT_DRIVER_STATE_STRUCT(instance) ALT_DRIVER_STATE(instance); \
|
||||
extern int ALT_DRIVER_FUNC_NAME(instance, write) \
|
||||
(ALT_DRIVER_STATE_STRUCT(instance) *, const char *, int, int);
|
||||
|
||||
#define ALT_DRIVER_WRITE(instance, buffer, len, flags) \
|
||||
ALT_DRIVER_FUNC_NAME(instance, write)(&ALT_DRIVER_STATE(instance), buffer, len, flags)
|
||||
|
||||
|
||||
/*
|
||||
* ALT_DRIVER_READ
|
||||
*
|
||||
* --> instance Instance name.
|
||||
* <-- buffer Read buffer.
|
||||
* --> len Length of read buffer.
|
||||
* --> flags Control flags (e.g. O_NONBLOCK)
|
||||
*
|
||||
* This macro calls the "read" function of the specified driver instance.
|
||||
*/
|
||||
|
||||
#define ALT_DRIVER_READ_EXTERNS(instance) \
|
||||
extern ALT_DRIVER_STATE_STRUCT(instance) ALT_DRIVER_STATE(instance); \
|
||||
extern int ALT_DRIVER_FUNC_NAME(instance, read) \
|
||||
(ALT_DRIVER_STATE_STRUCT(instance) *, const char *, int, int);
|
||||
|
||||
#define ALT_DRIVER_READ(instance, buffer, len, flags) \
|
||||
ALT_DRIVER_FUNC_NAME(instance, read)(&ALT_DRIVER_STATE(instance), buffer, len, flags)
|
||||
|
||||
/*
|
||||
* ALT_DRIVER_IOCTL
|
||||
*
|
||||
* --> instance Instance name.
|
||||
* --> req ioctl request (e.g. TIOCSTIMEOUT)
|
||||
* --> arg Optional argument (void*)
|
||||
*
|
||||
* This macro calls the "ioctl" function of the specified driver instance
|
||||
*/
|
||||
|
||||
#define ALT_DRIVER_IOCTL_EXTERNS(instance) \
|
||||
extern ALT_DRIVER_STATE_STRUCT(instance) ALT_DRIVER_STATE(instance); \
|
||||
extern int ALT_DRIVER_FUNC_NAME(instance, ioctl) \
|
||||
(ALT_DRIVER_STATE_STRUCT(instance) *, int, void*);
|
||||
|
||||
#define ALT_DRIVER_IOCTL(instance, req, arg) \
|
||||
ALT_DRIVER_FUNC_NAME(instance, ioctl)(&ALT_DRIVER_STATE(instance), req, arg)
|
||||
|
||||
#endif /* __ALT_DRIVER_H__ */
|
87
software/signal_processing_bsp/HAL/inc/sys/alt_errno.h
Normal file
87
software/signal_processing_bsp/HAL/inc/sys/alt_errno.h
Normal file
@ -0,0 +1,87 @@
|
||||
#ifndef __ALT_ERRNO_H__
|
||||
#define __ALT_ERRNO_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* errno is defined in <errno.h> so that it uses the thread local version
|
||||
* stored in the location pointed to by "_impure_ptr". This means that the
|
||||
* accesses to errno within the HAL library can cause the entirety of
|
||||
* of the structure pointed to by "_impure_ptr" to be added to the
|
||||
* users application. This can be undesirable in very small footprint systems.
|
||||
*
|
||||
* To avoid this happening, the HAL uses the macro ALT_ERRNO, defined below,
|
||||
* to access errno, rather than accessing it directly. This macro will only
|
||||
* use the thread local version if some other code has already caused it to be
|
||||
* included into the system, otherwise it will use the global errno value.
|
||||
*
|
||||
* This causes a slight increases in code size where errno is accessed, but
|
||||
* can lead to significant overall benefits in very small systems. The
|
||||
* increase is inconsequential when compared to the size of the structure
|
||||
* pointed to by _impure_ptr.
|
||||
*
|
||||
* Note that this macro accesses __errno() using an externally declared
|
||||
* function pointer (alt_errno). This is done so that the function call uses the
|
||||
* subroutine call instruction via a register rather than an immediate address.
|
||||
* This is important in the case that the code has been linked for a high
|
||||
* address, but __errno() is not being used. In this case the weak linkage
|
||||
* would have resulted in the instruction: "call 0" which would fail to link.
|
||||
*/
|
||||
|
||||
extern int* (*alt_errno) (void);
|
||||
|
||||
/* Must define this so that values such as EBADFD are defined in errno.h. */
|
||||
#define __LINUX_ERRNO_EXTENSIONS__
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
#undef errno
|
||||
|
||||
extern int errno;
|
||||
|
||||
static ALT_INLINE int* alt_get_errno(void)
|
||||
{
|
||||
return ((alt_errno) ? alt_errno() : &errno);
|
||||
}
|
||||
|
||||
#define ALT_ERRNO *alt_get_errno()
|
||||
|
||||
#endif /* __ALT_ERRNO_H__ */
|
166
software/signal_processing_bsp/HAL/inc/sys/alt_exceptions.h
Normal file
166
software/signal_processing_bsp/HAL/inc/sys/alt_exceptions.h
Normal file
@ -0,0 +1,166 @@
|
||||
#ifndef __ALT_EXCEPTIONS_H__
|
||||
#define __ALT_EXCEPTIONS_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
#include "alt_types.h"
|
||||
#include "system.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* This file defines instruction-generated exception handling and registry
|
||||
* API, exception type enumeration, and handler return value enumeration for
|
||||
* Nios II.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following enumeration describes the value in the CPU EXCEPTION
|
||||
* register CAUSE bit field.
|
||||
*/
|
||||
enum alt_exception_cause_e {
|
||||
/*
|
||||
* This value is passed to an exception handler's cause argument if
|
||||
* "extra exceptions" information (EXECPTION) register is not
|
||||
* present in the processor hardware configuration.
|
||||
*/
|
||||
NIOS2_EXCEPTION_CAUSE_NOT_PRESENT = -1,
|
||||
|
||||
/*
|
||||
* Real values
|
||||
*/
|
||||
NIOS2_EXCEPTION_RESET = 0,
|
||||
NIOS2_EXCEPTION_CPU_ONLY_RESET_REQUEST = 1,
|
||||
NIOS2_EXCEPTION_INTERRUPT = 2,
|
||||
NIOS2_EXCEPTION_TRAP_INST = 3,
|
||||
NIOS2_EXCEPTION_UNIMPLEMENTED_INST = 4,
|
||||
NIOS2_EXCEPTION_ILLEGAL_INST = 5,
|
||||
NIOS2_EXCEPTION_MISALIGNED_DATA_ADDR = 6,
|
||||
NIOS2_EXCEPTION_MISALIGNED_TARGET_PC = 7,
|
||||
NIOS2_EXCEPTION_DIVISION_ERROR = 8,
|
||||
NIOS2_EXCEPTION_SUPERVISOR_ONLY_INST_ADDR = 9,
|
||||
NIOS2_EXCEPTION_SUPERVISOR_ONLY_INST = 10,
|
||||
NIOS2_EXCEPTION_SUPERVISOR_ONLY_DATA_ADDR = 11,
|
||||
NIOS2_EXCEPTION_TLB_MISS = 12,
|
||||
NIOS2_EXCEPTION_TLB_EXECUTE_PERM_VIOLATION = 13,
|
||||
NIOS2_EXCEPTION_TLB_READ_PERM_VIOLATION = 14,
|
||||
NIOS2_EXCEPTION_TLB_WRITE_PERM_VIOLATION = 15,
|
||||
NIOS2_EXCEPTION_MPU_INST_REGION_VIOLATION = 16,
|
||||
NIOS2_EXCEPTION_MPU_DATA_REGION_VIOLATION = 17,
|
||||
NIOS2_EXCEPTION_ECC_TLB_ERR = 18,
|
||||
NIOS2_EXCEPTION_ECC_FETCH_ERR = 19,
|
||||
NIOS2_EXCEPTION_ECC_REGISTER_FILE_ERR = 20,
|
||||
NIOS2_EXCEPTION_ECC_DATA_ERR = 21,
|
||||
NIOS2_EXCEPTION_ECC_DATA_CACHE_WRITEBACK_ERR = 22
|
||||
};
|
||||
typedef enum alt_exception_cause_e alt_exception_cause;
|
||||
|
||||
/*
|
||||
* These define valid return values for a user-defined instruction-generated
|
||||
* exception handler. The handler should return one of these to indicate
|
||||
* whether to re-issue the instruction that triggered the exception, or to
|
||||
* skip it.
|
||||
*/
|
||||
enum alt_exception_result_e {
|
||||
NIOS2_EXCEPTION_RETURN_REISSUE_INST = 0,
|
||||
NIOS2_EXCEPTION_RETURN_SKIP_INST = 1
|
||||
};
|
||||
typedef enum alt_exception_result_e alt_exception_result;
|
||||
|
||||
/*
|
||||
* alt_instruction_exception_register() can be used to register an exception
|
||||
* handler for instruction-generated exceptions that are not handled by the
|
||||
* built-in exception handler (i.e. for interrupts).
|
||||
*
|
||||
* The registry API is optionally enabled through the "Enable
|
||||
* Instruction-related Exception API" HAL BSP setting, which will
|
||||
* define the macro below.
|
||||
*/
|
||||
#ifdef ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API
|
||||
void alt_instruction_exception_register (
|
||||
alt_exception_result (*exception_handler)(
|
||||
alt_exception_cause cause,
|
||||
alt_u32 exception_pc,
|
||||
alt_u32 bad_addr) );
|
||||
#endif /*ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API */
|
||||
|
||||
/*
|
||||
* alt_exception_cause_generated_bad_addr() indicates whether a particular
|
||||
* exception cause value was from an exception-type that generated a valid
|
||||
* address in the BADADDR register. The contents of BADADDR is passed to
|
||||
* a user-registered exception handler in all cases, whether valid or not.
|
||||
* This routine should be called to validate the bad_addr argument to
|
||||
* your exception handler.
|
||||
*
|
||||
* Note that this routine will return false (0) for causes
|
||||
* NIOS2_EXCEPTION_TLB_MISS and NIOS2_EXCEPTION_ECC_TLB_ERR.
|
||||
* You must read the TLBMISC.D field to determine if BADADDR
|
||||
* is valid for these (valid if TLBMISC.D = 1).
|
||||
*/
|
||||
int alt_exception_cause_generated_bad_addr(alt_exception_cause cause);
|
||||
|
||||
/*
|
||||
* alt_ecc_fatal_exception_register() is called to register a handler to
|
||||
* service likely fatal ECC error exceptions. Likely the handler will
|
||||
* assume that correct execution of the running software is not possible
|
||||
* and re-initialize the processor (e.g. jump to reset address).
|
||||
*
|
||||
* Passing null (0x0) in the handler argument will disable a previously-
|
||||
* registered handler.
|
||||
*
|
||||
* Note that if no handler is registered, just normal exception processing
|
||||
* occurs on a likely fatal ECC exception and the exception processing
|
||||
* code might trigger an infinite exception loop.
|
||||
*
|
||||
* Note that the handler isn't a C function: it must be written in
|
||||
* assembly-code because it doesn't support C language calling conventions
|
||||
* and it can't return.
|
||||
*
|
||||
* The handler code must be carefully written to avoid triggering
|
||||
* another fatal ECC exception and creating an infinite exception loop.
|
||||
* The handler must avoid reading registers in case the fatal ECC
|
||||
* error is a register file ECC error.
|
||||
* If a data cache is present, the handler must avoid instructions that
|
||||
* access the data cache in case the fatal ECC error is a data cache
|
||||
* related ECC error. This includes cacheable load, cacheable store,
|
||||
* non-cacheable store (because it looks in the data cache to update the
|
||||
* data cache if it hits), and all data cache management instructions except
|
||||
* for INITD.
|
||||
*/
|
||||
void alt_ecc_fatal_exception_register(alt_u32 handler);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __ALT_EXCEPTIONS_H__ */
|
181
software/signal_processing_bsp/HAL/inc/sys/alt_flash.h
Normal file
181
software/signal_processing_bsp/HAL/inc/sys/alt_flash.h
Normal file
@ -0,0 +1,181 @@
|
||||
#ifndef __ALT_FLASH_H__
|
||||
#define __ALT_FLASH_H__
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2015 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* Alt_flash.h - User interface for flash code *
|
||||
* *
|
||||
* Use this interface to avoid being exposed to the internals of the device *
|
||||
* driver architecture. If you chose to use the flash driver internal *
|
||||
* structures we don't guarantee not to change them *
|
||||
* *
|
||||
* Author PRR *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "alt_types.h"
|
||||
#include "alt_flash_types.h"
|
||||
#include "alt_flash_dev.h"
|
||||
#include "sys/alt_cache.h"
|
||||
|
||||
alt_flash_fd* alt_flash_open_dev(const char* name);
|
||||
void alt_flash_close_dev(alt_flash_fd* fd );
|
||||
|
||||
/*
|
||||
* alt_flash_lock
|
||||
*
|
||||
* Locks the range of the memory sectors, which
|
||||
* protected from write and erase.
|
||||
*
|
||||
*/
|
||||
static __inline__ int __attribute__ ((always_inline)) alt_lock_flash(
|
||||
alt_flash_fd* fd, alt_u32 sectors_to_lock)
|
||||
{
|
||||
return fd->lock( fd, sectors_to_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_write_flash
|
||||
*
|
||||
* Program a buffer into flash.
|
||||
*
|
||||
* This routine erases all the affected erase blocks (if necessary)
|
||||
* and then programs the data. However it does not read the data out first
|
||||
* and preserve and none overwritten data, because this would require very
|
||||
* large buffers on the target. If you need
|
||||
* that functionality use the functions below.
|
||||
*/
|
||||
static __inline__ int __attribute__ ((always_inline)) alt_write_flash(
|
||||
alt_flash_fd* fd,
|
||||
int offset,
|
||||
const void* src_addr,
|
||||
int length )
|
||||
{
|
||||
return fd->write( fd, offset, src_addr, length );
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_read_flash
|
||||
*
|
||||
* Read a block of flash for most flashes this is just memcpy
|
||||
* it's here for completeness in case we need it for some serial flash device
|
||||
*
|
||||
*/
|
||||
static __inline__ int __attribute__ ((always_inline)) alt_read_flash(
|
||||
alt_flash_fd* fd, int offset,
|
||||
void* dest_addr, int length )
|
||||
{
|
||||
return fd->read( fd, offset, dest_addr, length );
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_get_flash_info
|
||||
*
|
||||
* Return the information on the flash sectors.
|
||||
*
|
||||
*/
|
||||
static __inline__ int __attribute__ ((always_inline)) alt_get_flash_info(
|
||||
alt_flash_fd* fd, flash_region** info,
|
||||
int* number_of_regions)
|
||||
{
|
||||
return fd->get_info( fd, info, number_of_regions);
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_erase_flash_block
|
||||
*
|
||||
* Erase a particular erase block, pass in the offset to the start of
|
||||
* the block and it's size
|
||||
*/
|
||||
static __inline__ int __attribute__ ((always_inline)) alt_erase_flash_block(
|
||||
alt_flash_fd* fd, int offset, int length)
|
||||
{
|
||||
int ret_code;
|
||||
ret_code = fd->erase_block( fd, offset );
|
||||
|
||||
/* remove dcache_flush call for FB330552
|
||||
if(!ret_code)
|
||||
alt_dcache_flush((alt_u8*)fd->base_addr + offset, length);
|
||||
*/
|
||||
return ret_code;
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_write_flash_block
|
||||
*
|
||||
* Write a particular flash block, block_offset is the offset
|
||||
* (from the base of flash) to start of the block
|
||||
* data_offset is the offset (from the base of flash)
|
||||
* where you wish to start programming
|
||||
*
|
||||
* NB this function DOES NOT check that you are only writing a single
|
||||
* block of data as that would slow down this function.
|
||||
*
|
||||
* Use alt_write_flash if you want that level of error checking.
|
||||
*/
|
||||
|
||||
static __inline__ int __attribute__ ((always_inline)) alt_write_flash_block(
|
||||
alt_flash_fd* fd, int block_offset,
|
||||
int data_offset,
|
||||
const void *data, int length)
|
||||
{
|
||||
|
||||
int ret_code;
|
||||
ret_code = fd->write_block( fd, block_offset, data_offset, data, length );
|
||||
|
||||
/* remove dcache_flush call for FB330552
|
||||
if(!ret_code)
|
||||
alt_dcache_flush((alt_u8*)fd->base_addr + data_offset, length);
|
||||
*/
|
||||
return ret_code;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_FLASH_H__ */
|
100
software/signal_processing_bsp/HAL/inc/sys/alt_flash_dev.h
Normal file
100
software/signal_processing_bsp/HAL/inc/sys/alt_flash_dev.h
Normal file
@ -0,0 +1,100 @@
|
||||
#ifndef __ALT_FLASH_DEV_H__
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2015 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* Alt_flash_dev.h - Generic Flash device interfaces *
|
||||
* *
|
||||
* Author PRR *
|
||||
* *
|
||||
******************************************************************************/
|
||||
#define __ALT_FLASH_DEV_H__
|
||||
|
||||
#include "alt_flash_types.h"
|
||||
#include "sys/alt_llist.h"
|
||||
#include "priv/alt_dev_llist.h"
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
typedef struct alt_flash_dev alt_flash_dev;
|
||||
typedef alt_flash_dev alt_flash_fd;
|
||||
|
||||
static ALT_INLINE int alt_flash_device_register( alt_flash_fd* fd)
|
||||
{
|
||||
extern alt_llist alt_flash_dev_list;
|
||||
|
||||
return alt_dev_llist_insert ((alt_dev_llist*) fd, &alt_flash_dev_list);
|
||||
}
|
||||
|
||||
typedef alt_flash_dev* (*alt_flash_open)(alt_flash_dev* flash,
|
||||
const char* name );
|
||||
typedef int (*alt_flash_close)(alt_flash_dev* flash_info);
|
||||
|
||||
typedef int (*alt_flash_write)( alt_flash_dev* flash, int offset,
|
||||
const void* src_addr, int length );
|
||||
|
||||
typedef int (*alt_flash_get_flash_info)( alt_flash_dev* flash, flash_region** info,
|
||||
int* number_of_regions);
|
||||
typedef int (*alt_flash_write_block)( alt_flash_dev* flash, int block_offset,
|
||||
int data_offset, const void* data,
|
||||
int length);
|
||||
typedef int (*alt_flash_erase_block)( alt_flash_dev* flash, int offset);
|
||||
typedef int (*alt_flash_read)(alt_flash_dev* flash, int offset,
|
||||
void* dest_addr, int length );
|
||||
typedef int (*alt_flash_lock)(alt_flash_dev* flash, alt_u32 sectors_to_lock);
|
||||
|
||||
struct alt_flash_dev
|
||||
{
|
||||
alt_llist llist;
|
||||
const char* name;
|
||||
alt_flash_open open;
|
||||
alt_flash_close close;
|
||||
alt_flash_write write;
|
||||
alt_flash_read read;
|
||||
alt_flash_get_flash_info get_info;
|
||||
alt_flash_erase_block erase_block;
|
||||
alt_flash_write_block write_block;
|
||||
void* base_addr;
|
||||
int length;
|
||||
int number_of_regions;
|
||||
flash_region region_info[ALT_MAX_NUMBER_OF_FLASH_REGIONS];
|
||||
alt_flash_lock lock;
|
||||
};
|
||||
|
||||
#endif /* __ALT_FLASH_DEV_H__ */
|
64
software/signal_processing_bsp/HAL/inc/sys/alt_flash_types.h
Normal file
64
software/signal_processing_bsp/HAL/inc/sys/alt_flash_types.h
Normal file
@ -0,0 +1,64 @@
|
||||
#ifndef __ALT_FLASH_TYPES_H__
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* Alt_flash_types.h - Some generic types and defines used by the flash code *
|
||||
* *
|
||||
* Author PRR *
|
||||
* *
|
||||
******************************************************************************/
|
||||
#define __ALT_FLASH_TYPES_H__
|
||||
|
||||
#ifndef ALT_MAX_NUMBER_OF_FLASH_REGIONS
|
||||
#define ALT_MAX_NUMBER_OF_FLASH_REGIONS 8
|
||||
#endif /* ALT_MAX_NUMBER_OF_FLASH_REGIONS */
|
||||
|
||||
/*
|
||||
* Description of a single Erase region
|
||||
*/
|
||||
typedef struct flash_region
|
||||
{
|
||||
int offset;
|
||||
int region_size;
|
||||
int number_of_blocks;
|
||||
int block_size;
|
||||
}flash_region;
|
||||
|
||||
#endif /* __ALT_FLASH_TYPES_H__ */
|
245
software/signal_processing_bsp/HAL/inc/sys/alt_irq.h
Normal file
245
software/signal_processing_bsp/HAL/inc/sys/alt_irq.h
Normal file
@ -0,0 +1,245 @@
|
||||
#ifndef __ALT_IRQ_H__
|
||||
#define __ALT_IRQ_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* alt_irq.h is the Nios II specific implementation of the interrupt controller
|
||||
* interface.
|
||||
*
|
||||
* Nios II includes optional support for an external interrupt controller.
|
||||
* When an external controller is present, the "Enhanced" interrupt API
|
||||
* must be used to manage individual interrupts. The enhanced API also
|
||||
* supports the processor's internal interrupt controller. Certain API
|
||||
* members are accessible from either the "legacy" or "enhanced" interrpt
|
||||
* API.
|
||||
*
|
||||
* Regardless of which API is in use, this file should be included by
|
||||
* application code and device drivers that register ISRs or manage interrpts.
|
||||
*/
|
||||
#include <errno.h>
|
||||
|
||||
#include "nios2.h"
|
||||
#include "alt_types.h"
|
||||
#include "system.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Macros used by alt_irq_enabled
|
||||
*/
|
||||
#define ALT_IRQ_ENABLED 1
|
||||
#define ALT_IRQ_DISABLED 0
|
||||
|
||||
/*
|
||||
* Number of available interrupts in internal interrupt controller.
|
||||
*/
|
||||
#define ALT_NIRQ NIOS2_NIRQ
|
||||
|
||||
/*
|
||||
* Used by alt_irq_disable_all() and alt_irq_enable_all().
|
||||
*/
|
||||
typedef int alt_irq_context;
|
||||
|
||||
/* ISR Prototype */
|
||||
#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT
|
||||
typedef void (*alt_isr_func)(void* isr_context);
|
||||
#else
|
||||
typedef void (*alt_isr_func)(void* isr_context, alt_u32 id);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following protypes and routines are supported by both
|
||||
* the enhanced and legacy interrupt APIs
|
||||
*/
|
||||
|
||||
/*
|
||||
* alt_irq_enabled can be called to determine if the processor's global
|
||||
* interrupt enable is asserted. The return value is zero if interrupts
|
||||
* are disabled, and non-zero otherwise.
|
||||
*
|
||||
* Whether the internal or external interrupt controller is present,
|
||||
* individual interrupts may still be disabled. Use the other API to query
|
||||
* a specific interrupt.
|
||||
*/
|
||||
static ALT_INLINE int ALT_ALWAYS_INLINE alt_irq_enabled (void)
|
||||
{
|
||||
int status;
|
||||
|
||||
NIOS2_READ_STATUS (status);
|
||||
|
||||
return status & NIOS2_STATUS_PIE_MSK;
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_irq_disable_all()
|
||||
*
|
||||
* This routine inhibits all interrupts by negating the status register PIE
|
||||
* bit. It returns the previous contents of the CPU status register (IRQ
|
||||
* context) which can be used to restore the status register PIE bit to its
|
||||
* state before this routine was called.
|
||||
*/
|
||||
static ALT_INLINE alt_irq_context ALT_ALWAYS_INLINE
|
||||
alt_irq_disable_all (void)
|
||||
{
|
||||
alt_irq_context context;
|
||||
|
||||
NIOS2_READ_STATUS (context);
|
||||
|
||||
NIOS2_WRITE_STATUS (context & ~NIOS2_STATUS_PIE_MSK);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_irq_enable_all()
|
||||
*
|
||||
* Enable all interrupts that were previously disabled by alt_irq_disable_all()
|
||||
*
|
||||
* This routine accepts a context to restore the CPU status register PIE bit
|
||||
* to the state prior to a call to alt_irq_disable_all().
|
||||
|
||||
* In the case of nested calls to alt_irq_disable_all()/alt_irq_enable_all(),
|
||||
* this means that alt_irq_enable_all() does not necessarily re-enable
|
||||
* interrupts.
|
||||
*
|
||||
* This routine will perform a read-modify-write sequence to restore only
|
||||
* status.PIE if the processor is configured with options that add additional
|
||||
* writeable status register bits. These include the MMU, MPU, the enhanced
|
||||
* interrupt controller port, and shadow registers. Otherwise, as a performance
|
||||
* enhancement, status is overwritten with the prior context.
|
||||
*/
|
||||
static ALT_INLINE void ALT_ALWAYS_INLINE
|
||||
alt_irq_enable_all (alt_irq_context context)
|
||||
{
|
||||
#if (NIOS2_NUM_OF_SHADOW_REG_SETS > 0) || (defined NIOS2_EIC_PRESENT) || \
|
||||
(defined NIOS2_MMU_PRESENT) || (defined NIOS2_MPU_PRESENT)
|
||||
alt_irq_context status;
|
||||
|
||||
NIOS2_READ_STATUS (status);
|
||||
|
||||
status &= ~NIOS2_STATUS_PIE_MSK;
|
||||
status |= (context & NIOS2_STATUS_PIE_MSK);
|
||||
|
||||
NIOS2_WRITE_STATUS (status);
|
||||
#else
|
||||
NIOS2_WRITE_STATUS (context);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* The function alt_irq_init() is defined within the auto-generated file
|
||||
* alt_sys_init.c. This function calls the initilization macros for all
|
||||
* interrupt controllers in the system at config time, before any other
|
||||
* non-interrupt controller driver is initialized.
|
||||
*
|
||||
* The "base" parameter is ignored and only present for backwards-compatibility.
|
||||
* It is recommended that NULL is passed in for the "base" parameter.
|
||||
*/
|
||||
extern void alt_irq_init (const void* base);
|
||||
|
||||
/*
|
||||
* alt_irq_cpu_enable_interrupts() enables the CPU to start taking interrupts.
|
||||
*/
|
||||
static ALT_INLINE void ALT_ALWAYS_INLINE
|
||||
alt_irq_cpu_enable_interrupts (void)
|
||||
{
|
||||
NIOS2_WRITE_STATUS(NIOS2_STATUS_PIE_MSK
|
||||
#if defined(NIOS2_EIC_PRESENT) && (NIOS2_NUM_OF_SHADOW_REG_SETS > 0)
|
||||
| NIOS2_STATUS_RSIE_MSK
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes for the enhanced interrupt API.
|
||||
*/
|
||||
#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT
|
||||
/*
|
||||
* alt_ic_isr_register() can be used to register an interrupt handler. If the
|
||||
* function is succesful, then the requested interrupt will be enabled upon
|
||||
* return.
|
||||
*/
|
||||
extern int alt_ic_isr_register(alt_u32 ic_id,
|
||||
alt_u32 irq,
|
||||
alt_isr_func isr,
|
||||
void *isr_context,
|
||||
void *flags);
|
||||
|
||||
/*
|
||||
* alt_ic_irq_enable() and alt_ic_irq_disable() enable/disable a specific
|
||||
* interrupt by using IRQ port and interrupt controller instance.
|
||||
*/
|
||||
int alt_ic_irq_enable (alt_u32 ic_id, alt_u32 irq);
|
||||
int alt_ic_irq_disable(alt_u32 ic_id, alt_u32 irq);
|
||||
|
||||
/*
|
||||
* alt_ic_irq_enabled() indicates whether a specific interrupt, as
|
||||
* specified by IRQ port and interrupt controller instance is enabled.
|
||||
*/
|
||||
alt_u32 alt_ic_irq_enabled(alt_u32 ic_id, alt_u32 irq);
|
||||
|
||||
#else
|
||||
/*
|
||||
* Prototypes for the legacy interrupt API.
|
||||
*/
|
||||
#include "priv/alt_legacy_irq.h"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* alt_irq_pending() returns a bit list of the current pending interrupts.
|
||||
* This is used by alt_irq_handler() to determine which registered interrupt
|
||||
* handlers should be called.
|
||||
*
|
||||
* This routine is only available for the Nios II internal interrupt
|
||||
* controller.
|
||||
*/
|
||||
#ifndef NIOS2_EIC_PRESENT
|
||||
static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_irq_pending (void)
|
||||
{
|
||||
alt_u32 active;
|
||||
|
||||
NIOS2_READ_IPENDING (active);
|
||||
|
||||
return active;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __ALT_IRQ_H__ */
|
39
software/signal_processing_bsp/HAL/inc/sys/alt_irq_entry.h
Normal file
39
software/signal_processing_bsp/HAL/inc/sys/alt_irq_entry.h
Normal file
@ -0,0 +1,39 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* This file pulls in the IRQ entry assembler and C code, which is only
|
||||
* required if there are any interruptes in the system.
|
||||
*/
|
||||
|
||||
__asm__( "\n\t.globl alt_irq_entry" );
|
||||
|
||||
__asm__( "\n\t.globl alt_irq_handler" );
|
||||
|
@ -0,0 +1,77 @@
|
||||
#ifndef __ALT_LICENSE_REMINDER_UCOSII_H__
|
||||
#define __ALT_LICENSE_REMINDER_UCOSII_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define ALT_LICENSE_REMINDER_UCOSII_STRING \
|
||||
"============== Software License Reminder ===============\n" \
|
||||
"\n" \
|
||||
"uC/OS-II is provided in source form for FREE evaluation,\n" \
|
||||
"for educational use, or for peaceful research. If you\n" \
|
||||
"plan on using uC/OS-II in a commercial product you need\n" \
|
||||
"to contact Micrium to properly license its use in your\n" \
|
||||
"product. Micrium provides ALL the source code on the\n" \
|
||||
"Altera distribution for your convenience and to help you\n" \
|
||||
"experience uC/OS-II. The fact that the source is provided\n" \
|
||||
"does NOT mean that you can use it without paying a\n" \
|
||||
"licensing fee. Please help us continue to provide the\n" \
|
||||
"Embedded community with the finest software available.\n" \
|
||||
"Your honesty is greatly appreciated.\n" \
|
||||
"\n" \
|
||||
"Please contact:\n" \
|
||||
"\n" \
|
||||
"M I C R I U M\n" \
|
||||
"949 Crestview Circle\n" \
|
||||
"Weston, FL 33327-1848\n" \
|
||||
"U.S.A.\n" \
|
||||
"\n" \
|
||||
"Phone : +1 954 217 2036\n" \
|
||||
"FAX : +1 954 217 2037\n" \
|
||||
"WEB : www.micrium.com\n" \
|
||||
"E-mail: Sales@Micrium.com\n" \
|
||||
"\n" \
|
||||
"========================================================\n"
|
||||
|
||||
#define alt_license_reminder_ucosii() puts(ALT_LICENSE_REMINDER_UCOSII_STRING)
|
||||
|
||||
|
||||
#endif /* __ALT_LICENSE_REMINDER_UCOSII_H__ */
|
||||
|
123
software/signal_processing_bsp/HAL/inc/sys/alt_llist.h
Normal file
123
software/signal_processing_bsp/HAL/inc/sys/alt_llist.h
Normal file
@ -0,0 +1,123 @@
|
||||
#ifndef __ALT_LIST_H__
|
||||
#define __ALT_LIST_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
/*
|
||||
* alt_llist.h defines structures and functions for use in manipulating linked
|
||||
* lists. A list is considered to be constructed from a chain of objects of
|
||||
* type alt_llist, with one object being defined to be the head element.
|
||||
*
|
||||
* A list is considered to be empty if it only contains the head element.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* alt_llist is the structure used to represent an element within a linked
|
||||
* list.
|
||||
*/
|
||||
|
||||
typedef struct alt_llist_s alt_llist;
|
||||
|
||||
struct alt_llist_s {
|
||||
alt_llist* next; /* Pointer to the next element in the list. */
|
||||
alt_llist* previous; /* Pointer to the previous element in the list. */
|
||||
};
|
||||
|
||||
/*
|
||||
* ALT_LLIST_HEAD is a macro that can be used to create the head of a new
|
||||
* linked list. This is named "head". The head element is initialised to
|
||||
* represent an empty list.
|
||||
*/
|
||||
|
||||
#define ALT_LLIST_HEAD(head) alt_llist head = {&head, &head}
|
||||
|
||||
/*
|
||||
* ALT_LLIST_ENTRY is a macro used to define an uninitialised linked list
|
||||
* entry. This is used to reserve space in structure initialisation for
|
||||
* structures that inherit form alt_llist.
|
||||
*/
|
||||
|
||||
#define ALT_LLIST_ENTRY {0, 0}
|
||||
|
||||
/*
|
||||
* alt_llist_insert() insert adds the linked list entry "entry" as the
|
||||
* first entry in the linked list "list". "list" is the list head element.
|
||||
*/
|
||||
|
||||
static ALT_INLINE void ALT_ALWAYS_INLINE alt_llist_insert(alt_llist* list,
|
||||
alt_llist* entry)
|
||||
{
|
||||
entry->previous = list;
|
||||
entry->next = list->next;
|
||||
|
||||
list->next->previous = entry;
|
||||
list->next = entry;
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_llist_remove() is called to remove an element from a linked list. The
|
||||
* input argument is the element to remove.
|
||||
*/
|
||||
|
||||
static ALT_INLINE void ALT_ALWAYS_INLINE alt_llist_remove(alt_llist* entry)
|
||||
{
|
||||
entry->next->previous = entry->previous;
|
||||
entry->previous->next = entry->next;
|
||||
|
||||
/*
|
||||
* Set the entry to point to itself, so that any further calls to
|
||||
* alt_llist_remove() are harmless.
|
||||
*/
|
||||
|
||||
entry->previous = entry;
|
||||
entry->next = entry;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_LLIST_H__ */
|
78
software/signal_processing_bsp/HAL/inc/sys/alt_load.h
Normal file
78
software/signal_processing_bsp/HAL/inc/sys/alt_load.h
Normal file
@ -0,0 +1,78 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2005 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
/*
|
||||
* This macro is used to load code/data from its load address to its
|
||||
* execution address for a given section. The section name is the input
|
||||
* argument. Note that a leading '.' is assumed in the name. For example
|
||||
* to load the section .onchip_ram, use:
|
||||
*
|
||||
* ALT_LOAD_SECTION_BY_NAME(onchip_ram);
|
||||
*
|
||||
* This requires that the apropriate linker symbols have been generated
|
||||
* for the section in question. This will be the case if you are using the
|
||||
* default linker script.
|
||||
*/
|
||||
|
||||
#define ALT_LOAD_SECTION_BY_NAME(name) \
|
||||
{ \
|
||||
extern void _alt_partition_##name##_start; \
|
||||
extern void _alt_partition_##name##_end; \
|
||||
extern void _alt_partition_##name##_load_addr; \
|
||||
\
|
||||
alt_load_section(&_alt_partition_##name##_load_addr, \
|
||||
&_alt_partition_##name##_start, \
|
||||
&_alt_partition_##name##_end); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Function used to load an individual section from flash to RAM.
|
||||
*
|
||||
* There is an implicit assumption here that the linker script will ensure
|
||||
* that all sections are word aligned.
|
||||
*
|
||||
*/
|
||||
|
||||
static void ALT_INLINE alt_load_section (alt_u32* from,
|
||||
alt_u32* to,
|
||||
alt_u32* end)
|
||||
{
|
||||
if (to != from)
|
||||
{
|
||||
while( to != end )
|
||||
{
|
||||
*to++ = *from++;
|
||||
}
|
||||
}
|
||||
}
|
354
software/signal_processing_bsp/HAL/inc/sys/alt_log_printf.h
Normal file
354
software/signal_processing_bsp/HAL/inc/sys/alt_log_printf.h
Normal file
@ -0,0 +1,354 @@
|
||||
/* alt_log_printf.h
|
||||
*
|
||||
* ALT_LOG is designed to provide extra logging/debugging messages from HAL
|
||||
* through a different port than stdout. It is enabled by the ALT_LOG_ENABLE
|
||||
* define, which needs to supplied at compile time. When logging is turned off,
|
||||
* code size is unaffected. Thus, this should be transparent to the user
|
||||
* when it is not actively turned on, and should not affect projects in any way.
|
||||
*
|
||||
* There are macros sprinkled within different components, such as the jtag uart
|
||||
* and timer, in the HAL code. They are always named ALT_LOG_<name>, and can be
|
||||
* safely ignored if ALT_LOG is turned off.
|
||||
*
|
||||
* To turn on ALT_LOG, ALT_LOG_ENABLE must be defined, and ALT_LOG_PORT_TYPE and
|
||||
* ALT_LOG_PORT_BASE must be set in system.h. This is done through editing
|
||||
* <project>.ptf, by editing the alt_log_port_type & alt_log_port_base settings.
|
||||
* See the documentation html file for examples.
|
||||
*
|
||||
* When it is turned on, it will output extra HAL messages to a port specified
|
||||
* in system.h. This can be a UART or JTAG UART port. By default it will
|
||||
* output boot messages, detailing every step of the boot process.
|
||||
*
|
||||
* Extra logging is designed to be enabled by flags, which are defined in
|
||||
* alt_log_printf.c. The default value is that all flags are off, so only the
|
||||
* boot up logging messages show up. ALT_LOG_FLAGS can be set to enable certain
|
||||
* groupings of flags, and that grouping is done in this file. Each flag can
|
||||
* also be overridden with a -D at compile time.
|
||||
*
|
||||
* This header file includes the necessary prototypes for using the alt_log
|
||||
* functions. It also contains all the macros that are used to remove the code
|
||||
* from alt log is turned off. Also, the macros in other HAL files are defined
|
||||
* here at the bottom. These macros all call some C function that is in
|
||||
* alt_log_printf.c.
|
||||
*
|
||||
* The logging has functions for printing in C (ALT_LOG_PRINTF) and in assembly
|
||||
* (ALT_LOG_PUTS). This was needed because the assembly printing occurs before
|
||||
* the device is initialized. The assembly function corrupts register R4-R7,
|
||||
* which are not used in the normal boot process. For this reason, do not call
|
||||
* the assembly function in C.
|
||||
*
|
||||
* author: gkwan
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __ALT_LOG_PRINTF_H__
|
||||
#define __ALT_LOG_PRINTF_H__
|
||||
|
||||
#include <system.h>
|
||||
|
||||
/* Global switch to turn on logging functions */
|
||||
#ifdef ALT_LOG_ENABLE
|
||||
|
||||
/* ALT_LOG_PORT_TYPE values as defined in system.h. They are defined as
|
||||
* numbers here first becasue the C preprocessor does not handle string
|
||||
* comparisons. */
|
||||
#define ALTERA_AVALON_JTAG_UART 1
|
||||
#define ALTERA_AVALON_UART 0
|
||||
|
||||
/* If this .h file is included by an assembly file, skip over include files
|
||||
* that won't compile in assembly. */
|
||||
#ifndef ALT_ASM_SRC
|
||||
#include <stdarg.h>
|
||||
#include "sys/alt_alarm.h"
|
||||
#include "sys/alt_dev.h"
|
||||
#ifdef __ALTERA_AVALON_JTAG_UART
|
||||
#include "altera_avalon_jtag_uart.h"
|
||||
#endif
|
||||
#endif /* ALT_ASM_SRC */
|
||||
|
||||
/* These are included for the port register offsets and masks, needed
|
||||
* to write to the port. Only include if the port type is set correctly,
|
||||
* otherwise error. If alt_log is turned on and the port to output to is
|
||||
* incorrect or does not exist, then should exit. */
|
||||
#if ALT_LOG_PORT_TYPE == ALTERA_AVALON_JTAG_UART
|
||||
#ifdef __ALTERA_AVALON_JTAG_UART
|
||||
#include <altera_avalon_jtag_uart_regs.h>
|
||||
#else
|
||||
#error ALT_LOG: JTAG_UART port chosen, but no JTAG_UART in system.
|
||||
#endif
|
||||
#elif ALT_LOG_PORT_TYPE == ALTERA_AVALON_UART
|
||||
#ifdef __ALTERA_AVALON_UART
|
||||
#include <altera_avalon_uart_regs.h>
|
||||
#else
|
||||
#error ALT_LOG: UART Port chosen, but no UART in system.
|
||||
#endif
|
||||
#else
|
||||
#error ALT_LOG: alt_log_port_type declaration invalid!
|
||||
#endif
|
||||
|
||||
/* ALT_LOG_ENABLE turns on the basic printing function */
|
||||
#define ALT_LOG_PRINTF(...) do {alt_log_printf_proc(__VA_ARGS__);} while (0)
|
||||
|
||||
/* Assembly macro for printing in assembly, calls tx_log_str
|
||||
* which is in alt_log_macro.S.
|
||||
* If alt_log_boot_on_flag is 0, skips the printing */
|
||||
#define ALT_LOG_PUTS(str) movhi r4, %hiadj(alt_log_boot_on_flag) ; \
|
||||
addi r4, r4, %lo(alt_log_boot_on_flag) ; \
|
||||
ldwio r5, 0(r4) ; \
|
||||
beq r0, r5, 0f ; \
|
||||
movhi r4, %hiadj(str) ; \
|
||||
addi r4, r4, %lo(str) ; \
|
||||
call tx_log_str ; \
|
||||
0:
|
||||
|
||||
/* These defines are here to faciliate the use of one output function
|
||||
* (alt_log_txchar) to print to both the JTAG UART or the UART. Depending
|
||||
* on the port type, the status register, read mask, and output register
|
||||
* are set to the appropriate value for the port. */
|
||||
#if ALT_LOG_PORT_TYPE == ALTERA_AVALON_JTAG_UART
|
||||
#define ALT_LOG_PRINT_REG_RD IORD_ALTERA_AVALON_JTAG_UART_CONTROL
|
||||
#define ALT_LOG_PRINT_MSK ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_MSK
|
||||
#define ALT_LOG_PRINT_TXDATA_WR IOWR_ALTERA_AVALON_JTAG_UART_DATA
|
||||
#define ALT_LOG_PRINT_REG_OFFSET (ALTERA_AVALON_JTAG_UART_CONTROL_REG*0x4)
|
||||
#define ALT_LOG_PRINT_TXDATA_REG_OFFSET (ALTERA_AVALON_JTAG_UART_DATA_REG*0x4)
|
||||
#elif ALT_LOG_PORT_TYPE == ALTERA_AVALON_UART
|
||||
#define ALT_LOG_PRINT_REG_RD IORD_ALTERA_AVALON_UART_STATUS
|
||||
#define ALT_LOG_PRINT_MSK ALTERA_AVALON_UART_STATUS_TRDY_MSK
|
||||
#define ALT_LOG_PRINT_TXDATA_WR IOWR_ALTERA_AVALON_UART_TXDATA
|
||||
#define ALT_LOG_PRINT_REG_OFFSET (ALTERA_AVALON_UART_STATUS_REG*0x4)
|
||||
#define ALT_LOG_PRINT_TXDATA_REG_OFFSET (ALTERA_AVALON_UART_TXDATA_REG*0x4)
|
||||
#endif /* ALT_LOG_PORT */
|
||||
|
||||
/* Grouping of flags via ALT_LOG_FLAGS. Each specific flag can be set via
|
||||
* -D at compile time, or else they'll be set to a default value according
|
||||
* to ALT_LOG_FLAGS. ALT_LOG_FLAGS = 0 or not set is the default, where
|
||||
* only the boot messages will be printed. As ALT_LOG_FLAGS increase, they
|
||||
* increase in intrusiveness to the program, and will affect performance.
|
||||
*
|
||||
* Flag Level 1 - turns on system clock and JTAG UART startup status
|
||||
* 2 - turns on write echo and JTAG_UART alarm (periodic report)
|
||||
* 3 - turns on JTAG UART ISR logging - will slow performance
|
||||
* significantly.
|
||||
* -1 - All logging output is off, but if ALT_LOG_ENABLE is
|
||||
* defined all logging function is built and code size
|
||||
* remains constant
|
||||
*
|
||||
* Flag settings - 1 = on, 0 = off. */
|
||||
|
||||
/* This flag turns on "boot" messages for printing. This includes messages
|
||||
* during crt0.S, then alt_main, and finally alt_exit. */
|
||||
#ifndef ALT_LOG_BOOT_ON_FLAG_SETTING
|
||||
#if ALT_LOG_FLAGS == 1
|
||||
#define ALT_LOG_BOOT_ON_FLAG_SETTING 0x1
|
||||
#elif ALT_LOG_FLAGS == 2
|
||||
#define ALT_LOG_BOOT_ON_FLAG_SETTING 0x1
|
||||
#elif ALT_LOG_FLAGS == 3
|
||||
#define ALT_LOG_BOOT_ON_FLAG_SETTING 0x1
|
||||
#elif ALT_LOG_FLAGS == -1 /* silent mode */
|
||||
#define ALT_LOG_BOOT_ON_FLAG_SETTING 0x0
|
||||
#else /* default setting */
|
||||
#define ALT_LOG_BOOT_ON_FLAG_SETTING 0x1
|
||||
#endif
|
||||
#endif /* ALT_LOG_BOOT_ON_FLAG_SETTING */
|
||||
|
||||
#ifndef ALT_LOG_SYS_CLK_ON_FLAG_SETTING
|
||||
#if ALT_LOG_FLAGS == 1
|
||||
#define ALT_LOG_SYS_CLK_ON_FLAG_SETTING 0x1
|
||||
#elif ALT_LOG_FLAGS == 2
|
||||
#define ALT_LOG_SYS_CLK_ON_FLAG_SETTING 0x1
|
||||
#elif ALT_LOG_FLAGS == 3
|
||||
#define ALT_LOG_SYS_CLK_ON_FLAG_SETTING 0x1
|
||||
#elif ALT_LOG_FLAGS == -1 /* silent mode */
|
||||
#define ALT_LOG_SYS_CLK_ON_FLAG_SETTING 0x0
|
||||
#else /* default setting */
|
||||
#define ALT_LOG_SYS_CLK_ON_FLAG_SETTING 0x0
|
||||
#endif
|
||||
#endif /* ALT_LOG_SYS_CLK_ON_FLAG_SETTING */
|
||||
|
||||
#ifndef ALT_LOG_WRITE_ON_FLAG_SETTING
|
||||
#if ALT_LOG_FLAGS == 1
|
||||
#define ALT_LOG_WRITE_ON_FLAG_SETTING 0x0
|
||||
#elif ALT_LOG_FLAGS == 2
|
||||
#define ALT_LOG_WRITE_ON_FLAG_SETTING 0x1
|
||||
#elif ALT_LOG_FLAGS == 3
|
||||
#define ALT_LOG_WRITE_ON_FLAG_SETTING 0x1
|
||||
#elif ALT_LOG_FLAGS == -1 /* silent mode */
|
||||
#define ALT_LOG_WRITE_ON_FLAG_SETTING 0x0
|
||||
#else /* default setting */
|
||||
#define ALT_LOG_WRITE_ON_FLAG_SETTING 0x0
|
||||
#endif
|
||||
#endif /* ALT_LOG_WRITE_ON_FLAG_SETTING */
|
||||
|
||||
#ifndef ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING
|
||||
#ifndef __ALTERA_AVALON_JTAG_UART
|
||||
#define ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING 0x0
|
||||
#elif ALT_LOG_FLAGS == 1
|
||||
#define ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING 0x0
|
||||
#elif ALT_LOG_FLAGS == 2
|
||||
#define ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING 0x1
|
||||
#elif ALT_LOG_FLAGS == 3
|
||||
#define ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING 0x1
|
||||
#elif ALT_LOG_FLAGS == -1 /* silent mode */
|
||||
#define ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING 0x0
|
||||
#else /* default setting */
|
||||
#define ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING 0x0
|
||||
#endif
|
||||
#endif /* ALT_LOG_JTAG_UART_ALARM_ON_FLAG_SETTING */
|
||||
|
||||
#ifndef ALT_LOG_JTAG_UART_STARTUP_INFO_ON_FLAG_SETTING
|
||||
#ifndef __ALTERA_AVALON_JTAG_UART
|
||||
#define ALT_LOG_JTAG_UART_STARTUP_INFO_ON_FLAG_SETTING 0x0
|
||||
#elif ALT_LOG_FLAGS == 1
|
||||
#define ALT_LOG_JTAG_UART_STARTUP_INFO_ON_FLAG_SETTING 0x1
|
||||
#elif ALT_LOG_FLAGS == 2
|
||||
#define ALT_LOG_JTAG_UART_STARTUP_INFO_ON_FLAG_SETTING 0x1
|
||||
#elif ALT_LOG_FLAGS == 3
|
||||
#define ALT_LOG_JTAG_UART_STARTUP_INFO_ON_FLAG_SETTING 0x1
|
||||
#elif ALT_LOG_FLAGS == -1 /* silent mode */
|
||||
#define ALT_LOG_JTAG_UART_STARTUP_INFO_ON_FLAG_SETTING 0x0
|
||||
#else /* default setting */
|
||||
#define ALT_LOG_JTAG_UART_STARTUP_INFO_ON_FLAG_SETTING 0x0
|
||||
#endif
|
||||
#endif /* ALT_LOG_JTAG_UART_STARTUP_INFO_FLAG_SETTING */
|
||||
|
||||
#ifndef ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING
|
||||
#ifndef __ALTERA_AVALON_JTAG_UART
|
||||
#define ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING 0x0
|
||||
#elif ALT_LOG_FLAGS == 1
|
||||
#define ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING 0x0
|
||||
#elif ALT_LOG_FLAGS == 2
|
||||
#define ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING 0x0
|
||||
#elif ALT_LOG_FLAGS == 3
|
||||
#define ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING 0x1
|
||||
#elif ALT_LOG_FLAGS == -1 /* silent mode */
|
||||
#define ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING 0x0
|
||||
#else /* default setting */
|
||||
#define ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING 0x0
|
||||
#endif
|
||||
#endif /* ALT_LOG_JTAG_UART_ISR_ON_FLAG_SETTING */
|
||||
|
||||
#ifndef ALT_ASM_SRC
|
||||
/* Function Prototypes */
|
||||
void alt_log_txchar(int c,char *uartBase);
|
||||
void alt_log_private_printf(const char *fmt,int base,va_list args);
|
||||
void alt_log_repchar(char c,int r,int base);
|
||||
int alt_log_printf_proc(const char *fmt, ... );
|
||||
void alt_log_system_clock();
|
||||
#ifdef __ALTERA_AVALON_JTAG_UART
|
||||
alt_u32 altera_avalon_jtag_uart_report_log(void * context);
|
||||
void alt_log_jtag_uart_startup_info(altera_avalon_jtag_uart_state* dev, int base);
|
||||
void alt_log_jtag_uart_print_control_reg(altera_avalon_jtag_uart_state* dev, \
|
||||
int base, const char* header);
|
||||
void alt_log_jtag_uart_isr_proc(int base, altera_avalon_jtag_uart_state* dev);
|
||||
#endif
|
||||
void alt_log_write(const void *ptr, size_t len);
|
||||
|
||||
/* extern all global variables */
|
||||
/* CASE:368514 - The boot message flag is linked into the sdata section
|
||||
* because if it is zero, it would otherwise be placed in the bss section.
|
||||
* alt_log examines this variable before the BSS is cleared in the boot-up
|
||||
* process.
|
||||
*/
|
||||
extern volatile alt_u32 alt_log_boot_on_flag __attribute__ ((section (".sdata")));
|
||||
extern volatile alt_u8 alt_log_write_on_flag;
|
||||
extern volatile alt_u8 alt_log_sys_clk_on_flag;
|
||||
extern volatile alt_u8 alt_log_jtag_uart_alarm_on_flag;
|
||||
extern volatile alt_u8 alt_log_jtag_uart_isr_on_flag;
|
||||
extern volatile alt_u8 alt_log_jtag_uart_startup_info_on_flag;
|
||||
extern volatile int alt_log_sys_clk_count;
|
||||
extern volatile int alt_system_clock_in_sec;
|
||||
extern alt_alarm alt_log_jtag_uart_alarm_1;
|
||||
#endif /* ALT_ASM_SRC */
|
||||
|
||||
|
||||
/* Below are the MACRO defines used in various HAL files. They check
|
||||
* if their specific flag is turned on; if it is, then it executes its
|
||||
* code.
|
||||
*
|
||||
* To keep this file reasonable, most of these macros calls functions,
|
||||
* which are defined in alt_log_printf.c. Look there for implementation
|
||||
* details. */
|
||||
|
||||
/* Boot Messages Logging */
|
||||
#define ALT_LOG_PRINT_BOOT(...) \
|
||||
do { if (alt_log_boot_on_flag==1) {ALT_LOG_PRINTF(__VA_ARGS__);} \
|
||||
} while (0)
|
||||
|
||||
/* JTAG UART Logging */
|
||||
/* number of ticks before alarm runs logging function */
|
||||
#ifndef ALT_LOG_JTAG_UART_TICKS_DIVISOR
|
||||
#define ALT_LOG_JTAG_UART_TICKS_DIVISOR 10
|
||||
#endif
|
||||
#ifndef ALT_LOG_JTAG_UART_TICKS
|
||||
#define ALT_LOG_JTAG_UART_TICKS \
|
||||
(alt_ticks_per_second()/ALT_LOG_JTAG_UART_TICKS_DIVISOR)
|
||||
#endif
|
||||
|
||||
/* if there's a JTAG UART defined, then enable these macros */
|
||||
#ifdef __ALTERA_AVALON_JTAG_UART
|
||||
|
||||
/* Macro in altera_avalon_jtag_uart.c, to register the alarm function.
|
||||
* Also, the startup register info is also printed here, as this is
|
||||
* called within the device driver initialization. */
|
||||
#define ALT_LOG_JTAG_UART_ALARM_REGISTER(dev, base) \
|
||||
do { if (alt_log_jtag_uart_alarm_on_flag==1) { \
|
||||
alt_alarm_start(&alt_log_jtag_uart_alarm_1, \
|
||||
ALT_LOG_JTAG_UART_TICKS, &altera_avalon_jtag_uart_report_log,\
|
||||
dev);} \
|
||||
if (alt_log_jtag_uart_startup_info_on_flag==1) {\
|
||||
alt_log_jtag_uart_startup_info(dev, base);} \
|
||||
} while (0)
|
||||
|
||||
/* JTAG UART IRQ Logging (when buffer is empty)
|
||||
* Inserted in the ISR in altera_avalon_jtag_uart.c */
|
||||
#define ALT_LOG_JTAG_UART_ISR_FUNCTION(base, dev) \
|
||||
do { alt_log_jtag_uart_isr_proc(base, dev); } while (0)
|
||||
/* else, define macros to nothing. Or else the jtag_uart specific types
|
||||
* will throw compiler errors */
|
||||
#else
|
||||
#define ALT_LOG_JTAG_UART_ALARM_REGISTER(dev, base)
|
||||
#define ALT_LOG_JTAG_UART_ISR_FUNCTION(base, dev)
|
||||
#endif
|
||||
|
||||
/* System clock logging
|
||||
* How often (in seconds) the system clock logging prints.
|
||||
* The default value is every 1 second */
|
||||
#ifndef ALT_LOG_SYS_CLK_INTERVAL_MULTIPLIER
|
||||
#define ALT_LOG_SYS_CLK_INTERVAL_MULTIPLIER 1
|
||||
#endif
|
||||
#ifndef ALT_LOG_SYS_CLK_INTERVAL
|
||||
#define ALT_LOG_SYS_CLK_INTERVAL \
|
||||
(alt_ticks_per_second()*ALT_LOG_SYS_CLK_INTERVAL_MULTIPLIER)
|
||||
#endif
|
||||
|
||||
/* System clock logging - prints a message every interval (set above)
|
||||
* to show that the system clock is alive.
|
||||
* This macro is used in altera_avalon_timer_sc.c */
|
||||
#define ALT_LOG_SYS_CLK_HEARTBEAT() \
|
||||
do { alt_log_system_clock(); } while (0)
|
||||
|
||||
/* alt_write_logging - echos a message every time write() is called,
|
||||
* displays the first ALT_LOG_WRITE_ECHO_LEN characters.
|
||||
* This macro is used in alt_write.c */
|
||||
#ifndef ALT_LOG_WRITE_ECHO_LEN
|
||||
#define ALT_LOG_WRITE_ECHO_LEN 15
|
||||
#endif
|
||||
|
||||
#define ALT_LOG_WRITE_FUNCTION(ptr,len) \
|
||||
do { alt_log_write(ptr,len); } while (0)
|
||||
|
||||
#else /* ALT_LOG_ENABLE not defined */
|
||||
|
||||
/* logging is off, set all relevant macros to null */
|
||||
#define ALT_LOG_PRINT_BOOT(...)
|
||||
#define ALT_LOG_PRINTF(...)
|
||||
#define ALT_LOG_JTAG_UART_ISR_FUNCTION(base, dev)
|
||||
#define ALT_LOG_JTAG_UART_ALARM_REGISTER(dev, base)
|
||||
#define ALT_LOG_SYS_CLK_HEARTBEAT()
|
||||
#define ALT_LOG_PUTS(str)
|
||||
#define ALT_LOG_WRITE_FUNCTION(ptr,len)
|
||||
|
||||
#endif /* ALT_LOG_ENABLE */
|
||||
|
||||
#endif /* __ALT_LOG_PRINTF_H__ */
|
||||
|
71
software/signal_processing_bsp/HAL/inc/sys/alt_set_args.h
Normal file
71
software/signal_processing_bsp/HAL/inc/sys/alt_set_args.h
Normal file
@ -0,0 +1,71 @@
|
||||
#ifndef __ALT_SET_ARGS_H__
|
||||
#define __ALT_SET_ARGS_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* The function alt_set_args() is provided in order to define the input
|
||||
* arguments to main(). If this function is not called before main() then the
|
||||
* argument list passed to main() will be empty.
|
||||
*
|
||||
* It is expected that this function will only be used by the ihost/iclient
|
||||
* utility.
|
||||
*/
|
||||
|
||||
static inline void alt_set_args (int argc, char** argv, char** envp)
|
||||
{
|
||||
extern int alt_argc;
|
||||
extern char** alt_argv;
|
||||
extern char** alt_envp;
|
||||
|
||||
alt_argc = argc;
|
||||
alt_argv = argv;
|
||||
alt_envp = envp;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_SET_ARGS_H__ */
|
91
software/signal_processing_bsp/HAL/inc/sys/alt_sim.h
Normal file
91
software/signal_processing_bsp/HAL/inc/sys/alt_sim.h
Normal file
@ -0,0 +1,91 @@
|
||||
#ifndef __ALT_SIM_H__
|
||||
#define __ALT_SIM_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2007 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
#include "system.h"
|
||||
#include "alt_types.h"
|
||||
|
||||
/*
|
||||
* Instructions that might mean something special to a simulator.
|
||||
* These have no special effect on real hardware (they are just nops).
|
||||
*/
|
||||
#define ALT_SIM_FAIL() \
|
||||
do { __asm volatile ("cmpltui r0, r0, 0xabc1"); } while (0)
|
||||
|
||||
#define ALT_SIM_PASS() \
|
||||
do { __asm volatile ("cmpltui r0, r0, 0xabc2"); } while (0)
|
||||
|
||||
#define ALT_SIM_IN_TOP_OF_HOT_LOOP() \
|
||||
do { __asm volatile ("cmpltui r0, r0, 0xabc3"); } while (0)
|
||||
|
||||
/*
|
||||
* Routine called on exit.
|
||||
*/
|
||||
static ALT_INLINE ALT_ALWAYS_INLINE void alt_sim_halt(int exit_code)
|
||||
{
|
||||
register int r2 asm ("r2") = exit_code;
|
||||
|
||||
#if defined(NIOS2_HAS_DEBUG_STUB) && (defined(ALT_BREAK_ON_EXIT) || defined(ALT_PROVIDE_GMON))
|
||||
|
||||
register int r3 asm ("r3") = (1 << 2);
|
||||
|
||||
#ifdef ALT_PROVIDE_GMON
|
||||
extern unsigned int alt_gmon_data[];
|
||||
register int r4 asm ("r4") = (int)alt_gmon_data;
|
||||
r3 |= (1 << 4);
|
||||
#define ALT_GMON_DATA ,"r"(r4)
|
||||
#else
|
||||
#define ALT_GMON_DATA
|
||||
#endif /* ALT_PROVIDE_GMON */
|
||||
|
||||
if (r2) {
|
||||
ALT_SIM_FAIL();
|
||||
} else {
|
||||
ALT_SIM_PASS();
|
||||
}
|
||||
|
||||
__asm__ volatile ("\n0:\n\taddi %0,%0, -1\n\tbgt %0,zero,0b" : : "r" (ALT_CPU_FREQ/100) ); /* Delay for >30ms */
|
||||
|
||||
__asm__ volatile ("break 2" : : "r"(r2), "r"(r3) ALT_GMON_DATA );
|
||||
|
||||
#else /* !DEBUG_STUB */
|
||||
if (r2) {
|
||||
ALT_SIM_FAIL();
|
||||
} else {
|
||||
ALT_SIM_PASS();
|
||||
}
|
||||
#endif /* DEBUG_STUB */
|
||||
}
|
||||
|
||||
#define ALT_SIM_HALT(exit_code) \
|
||||
alt_sim_halt(exit_code)
|
||||
|
||||
#endif /* __ALT_SIM_H__ */
|
126
software/signal_processing_bsp/HAL/inc/sys/alt_stack.h
Normal file
126
software/signal_processing_bsp/HAL/inc/sys/alt_stack.h
Normal file
@ -0,0 +1,126 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __ALT_STACK_H__
|
||||
#define __ALT_STACK_H__
|
||||
|
||||
/*
|
||||
* alt_stack.h is the nios2 specific implementation of functions used by the
|
||||
* stack overflow code.
|
||||
*/
|
||||
|
||||
#include "nios2.h"
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
extern char * alt_stack_limit_value;
|
||||
|
||||
#ifdef ALT_EXCEPTION_STACK
|
||||
extern char __alt_exception_stack_pointer[]; /* set by the linker */
|
||||
#endif /* ALT_EXCEPTION_STACK */
|
||||
|
||||
|
||||
/*
|
||||
* alt_stack_limit can be called to determine the current value of the stack
|
||||
* limit register.
|
||||
*/
|
||||
|
||||
static ALT_INLINE char * ALT_ALWAYS_INLINE alt_stack_limit (void)
|
||||
{
|
||||
char * limit;
|
||||
NIOS2_READ_ET(limit);
|
||||
|
||||
return limit;
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_stack_pointer can be called to determine the current value of the stack
|
||||
* pointer register.
|
||||
*/
|
||||
|
||||
static ALT_INLINE char * ALT_ALWAYS_INLINE alt_stack_pointer (void)
|
||||
{
|
||||
char * pointer;
|
||||
NIOS2_READ_SP(pointer);
|
||||
|
||||
return pointer;
|
||||
}
|
||||
|
||||
|
||||
#ifdef ALT_EXCEPTION_STACK
|
||||
|
||||
/*
|
||||
* alt_exception_stack_pointer returns the normal stack pointer from
|
||||
* where it is stored on the exception stack (uppermost 4 bytes). This
|
||||
* is really only useful during exception processing, and is only
|
||||
* available if a separate exception stack has been configured.
|
||||
*/
|
||||
|
||||
static ALT_INLINE char * ALT_ALWAYS_INLINE alt_exception_stack_pointer (void)
|
||||
{
|
||||
return (char *) *(alt_u32 *)(__alt_exception_stack_pointer - sizeof(alt_u32));
|
||||
}
|
||||
|
||||
#endif /* ALT_EXCEPTION_STACK */
|
||||
|
||||
|
||||
/*
|
||||
* alt_set_stack_limit can be called to update the current value of the stack
|
||||
* limit register.
|
||||
*/
|
||||
|
||||
static ALT_INLINE void ALT_ALWAYS_INLINE alt_set_stack_limit (char * limit)
|
||||
{
|
||||
alt_stack_limit_value = limit;
|
||||
NIOS2_WRITE_ET(limit);
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_report_stack_overflow reports that a stack overflow happened.
|
||||
*/
|
||||
|
||||
static ALT_INLINE void ALT_ALWAYS_INLINE alt_report_stack_overflow (void)
|
||||
{
|
||||
NIOS2_REPORT_STACK_OVERFLOW();
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __ALT_STACK_H__ */
|
||||
|
66
software/signal_processing_bsp/HAL/inc/sys/alt_stdio.h
Normal file
66
software/signal_processing_bsp/HAL/inc/sys/alt_stdio.h
Normal file
@ -0,0 +1,66 @@
|
||||
#ifndef __ALT_STDIO_H__
|
||||
#define __ALT_STDIO_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2015 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Definitions for ALT stdio routines.
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int alt_getchar();
|
||||
int alt_putchar(int c);
|
||||
int alt_putstr(const char* str);
|
||||
void alt_printf(const char *fmt, ...);
|
||||
#ifdef ALT_SEMIHOSTING
|
||||
int alt_putcharbuf(int c);
|
||||
int alt_putstrbuf(const char* str);
|
||||
int alt_putbufflush();
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_STDIO_H__ */
|
62
software/signal_processing_bsp/HAL/inc/sys/alt_sys_init.h
Normal file
62
software/signal_processing_bsp/HAL/inc/sys/alt_sys_init.h
Normal file
@ -0,0 +1,62 @@
|
||||
#ifndef __ALT_SYS_INIT_H__
|
||||
#define __ALT_SYS_INIT_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* The function alt_sys_init() is defined within the auto-generated file:
|
||||
* alt_sys_init.c. This function calls the initilisation macros for all
|
||||
* devices, file systems, and software components within the system.
|
||||
*
|
||||
* The list of initilisation macros to use is constructed using the PTF and
|
||||
* STF files associated with the system.
|
||||
*/
|
||||
|
||||
extern void alt_sys_init (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_SYS_INIT_H__ */
|
100
software/signal_processing_bsp/HAL/inc/sys/alt_sys_wrappers.h
Normal file
100
software/signal_processing_bsp/HAL/inc/sys/alt_sys_wrappers.h
Normal file
@ -0,0 +1,100 @@
|
||||
#ifndef __ALT_SYS_WRAPPERS_H__
|
||||
#define __ALT_SYS_WRAPPERS_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* This file provides the prototypes for the HAL 'UNIX style functions. The
|
||||
* names of these functions are defined in alt_syscall.h. THese are defined to
|
||||
* be the standard names when running the standalone HAL, e.g. open(), close()
|
||||
* etc., but the names may be redefined as a part of an operating system port
|
||||
* in order to avoid name clashes.
|
||||
*/
|
||||
|
||||
#include "os/alt_syscall.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
|
||||
extern int ALT_CLOSE (int __fd);
|
||||
extern int ALT_EXECVE (const char *__path,
|
||||
char * const __argv[],
|
||||
char * const __envp[]);
|
||||
extern void ALT_EXIT (int __status);
|
||||
extern int ALT_FSTAT (int file, struct stat *st);
|
||||
extern int ALT_FCNTL (int file, int cmd, ...);
|
||||
extern pid_t ALT_FORK (void);
|
||||
extern pid_t ALT_GETPID (void);
|
||||
|
||||
#if defined (__GNUC__) && __GNUC__ >= 4
|
||||
extern int ALT_GETTIMEOFDAY (struct timeval *ptimeval,
|
||||
void *ptimezone);
|
||||
#else
|
||||
extern int ALT_GETTIMEOFDAY (struct timeval *ptimeval,
|
||||
struct timezone *ptimezone);
|
||||
#endif
|
||||
|
||||
extern int ALT_IOCTL (int file, int req, void* arg);
|
||||
extern int ALT_ISATTY (int file);
|
||||
extern int ALT_KILL (int pid, int sig);
|
||||
extern int ALT_LINK (const char *existing, const char *new);
|
||||
extern off_t ALT_LSEEK (int file, off_t ptr, int dir);
|
||||
extern int ALT_OPEN (const char* file, int flags, ...);
|
||||
extern int ALT_READ (int file, void *ptr, size_t len);
|
||||
extern int ALT_RENAME (char *existing, char *new);
|
||||
extern void* ALT_SBRK (ptrdiff_t incr);
|
||||
extern int ALT_SETTIMEOFDAY (const struct timeval *t,
|
||||
const struct timezone *tz);
|
||||
extern int ALT_STAT (const char *file, struct stat *st);
|
||||
extern clock_t ALT_TIMES (struct tms *buf);
|
||||
extern int ALT_UNLINK (const char *name);
|
||||
|
||||
#if defined (__GNUC__) && __GNUC__ >= 4
|
||||
int ALT_USLEEP (useconds_t us);
|
||||
#else
|
||||
unsigned int ALT_USLEEP (unsigned int us);
|
||||
#endif
|
||||
|
||||
extern int ALT_WAIT (int *status);
|
||||
extern int ALT_WRITE (int file, const void *ptr, size_t len);
|
||||
|
||||
|
||||
extern char** ALT_ENVIRON;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#endif /* __ALT_SYS_WRAPPERS_H__ */
|
60
software/signal_processing_bsp/HAL/inc/sys/alt_timestamp.h
Normal file
60
software/signal_processing_bsp/HAL/inc/sys/alt_timestamp.h
Normal file
@ -0,0 +1,60 @@
|
||||
#ifndef __ALT_TIMESTAMP_H__
|
||||
#define __ALT_TIMESTAMP_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "alt_types.h"
|
||||
#include "altera_avalon_timer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern int alt_timestamp_start (void);
|
||||
|
||||
extern alt_timestamp_type alt_timestamp (void);
|
||||
|
||||
extern alt_u32 alt_timestamp_freq (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_TIMESTAMP_H__ */
|
75
software/signal_processing_bsp/HAL/inc/sys/alt_warning.h
Normal file
75
software/signal_processing_bsp/HAL/inc/sys/alt_warning.h
Normal file
@ -0,0 +1,75 @@
|
||||
#ifndef __WARNING_H__
|
||||
#define __WARNING_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* alt_warning.h provides macro definitions that can be used to generate link
|
||||
* time warnings.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* The symbol "__alt_invalid" is used to force a link error. There should be
|
||||
* no corresponding implementation of this function.
|
||||
*/
|
||||
|
||||
extern void __alt_invalid (void);
|
||||
|
||||
#define ALT_LINK_WARNING(symbol, msg) \
|
||||
__asm__(".ifndef __evoke_link_warning_" #symbol \
|
||||
"\n\t .section .gnu.warning." #symbol \
|
||||
"\n__evoke_link_warning_" #symbol ":\n\t .string \x22" msg "\x22 \n\t .previous" \
|
||||
"\n .endif");
|
||||
|
||||
/* A canned warning for sysdeps/stub functions. */
|
||||
|
||||
#define ALT_STUB_WARNING(name) \
|
||||
ALT_LINK_WARNING (name, \
|
||||
"warning: " #name " is not implemented and will always fail")
|
||||
|
||||
#define ALT_OBSOLETE_FUNCTION_WARNING(name) \
|
||||
ALT_LINK_WARNING (name, \
|
||||
"warning: " #name " is a deprecated function")
|
||||
|
||||
#define ALT_LINK_ERROR(msg) \
|
||||
ALT_LINK_WARNING (__alt_invalid, msg); \
|
||||
__alt_invalid()
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __WARNING_H__ */
|
90
software/signal_processing_bsp/HAL/inc/sys/ioctl.h
Normal file
90
software/signal_processing_bsp/HAL/inc/sys/ioctl.h
Normal file
@ -0,0 +1,90 @@
|
||||
#ifndef __IOCTL_H__
|
||||
#define __IOCTL_H__
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* The ioctl() system call be used to initiate a variety of control operations
|
||||
* on a file descriptor. For the most part this simply translates to a call to
|
||||
* the ioctl() function of the associated device driver (TIOCEXCL and
|
||||
* TIOCNXCL are notable exceptions - see ioctl.c for details).
|
||||
*
|
||||
* The interpretation of the ioctl requests are therefore device specific.
|
||||
*
|
||||
* This function is equivalent to the standard Posix ioctl() call.
|
||||
*/
|
||||
|
||||
extern int ioctl (int fd, int req, void* arg);
|
||||
|
||||
/*
|
||||
* list of ioctl calls handled by the system ioctl implementation.
|
||||
*/
|
||||
|
||||
#define TIOCEXCL 0x740d /* exclusive use of the device */
|
||||
#define TIOCNXCL 0x740e /* allow multiple use of the device */
|
||||
|
||||
/*
|
||||
* ioctl calls which can be handled by device drivers.
|
||||
*/
|
||||
|
||||
#define TIOCOUTQ 0x7472 /* get output queue size */
|
||||
#define TIOCMGET 0x741d /* get termios flags */
|
||||
#define TIOCMSET 0x741a /* set termios flags */
|
||||
|
||||
/*
|
||||
* ioctl calls specific to JTAG UART.
|
||||
*/
|
||||
|
||||
#define TIOCSTIMEOUT 0x6a01 /* Set Timeout before assuming no host present */
|
||||
#define TIOCGCONNECTED 0x6a02 /* Get indication of whether host is connected */
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __IOCTL_H__ */
|
181
software/signal_processing_bsp/HAL/inc/sys/termios.h
Normal file
181
software/signal_processing_bsp/HAL/inc/sys/termios.h
Normal file
@ -0,0 +1,181 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* This is the termios.h file provided with newlib. The only modification has
|
||||
* been to the baud rate macro definitions, and an increase in the size of the
|
||||
* termios structure to accomodate this.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _SYS_TERMIOS_H
|
||||
# define _SYS_TERMIOS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
# define _XCGETA (('x'<<8)|1)
|
||||
# define _XCSETA (('x'<<8)|2)
|
||||
# define _XCSETAW (('x'<<8)|3)
|
||||
# define _XCSETAF (('x'<<8)|4)
|
||||
# define _TCSBRK (('T'<<8)|5)
|
||||
# define _TCFLSH (('T'<<8)|7)
|
||||
# define _TCXONC (('T'<<8)|6)
|
||||
|
||||
# define TCOOFF 0
|
||||
# define TCOON 1
|
||||
# define TCIOFF 2
|
||||
# define TCION 3
|
||||
|
||||
# define TCIFLUSH 0
|
||||
# define TCOFLUSH 1
|
||||
# define TCIOFLUSH 2
|
||||
|
||||
# define NCCS 13
|
||||
|
||||
# define TCSAFLUSH _XCSETAF
|
||||
# define TCSANOW _XCSETA
|
||||
# define TCSADRAIN _XCSETAW
|
||||
# define TCSADFLUSH _XCSETAF
|
||||
|
||||
# define IGNBRK 000001
|
||||
# define BRKINT 000002
|
||||
# define IGNPAR 000004
|
||||
# define INPCK 000020
|
||||
# define ISTRIP 000040
|
||||
# define INLCR 000100
|
||||
# define IGNCR 000200
|
||||
# define ICRNL 000400
|
||||
# define IXON 002000
|
||||
# define IXOFF 010000
|
||||
|
||||
# define OPOST 000001
|
||||
# define OCRNL 000004
|
||||
# define ONLCR 000010
|
||||
# define ONOCR 000020
|
||||
# define TAB3 014000
|
||||
|
||||
# define CLOCAL 004000
|
||||
# define CREAD 000200
|
||||
# define CSIZE 000060
|
||||
# define CS5 0
|
||||
# define CS6 020
|
||||
# define CS7 040
|
||||
# define CS8 060
|
||||
# define CSTOPB 000100
|
||||
# define HUPCL 002000
|
||||
# define PARENB 000400
|
||||
# define PAODD 001000
|
||||
|
||||
#define CCTS_OFLOW 010000
|
||||
#define CRTS_IFLOW 020000
|
||||
#define CRTSCTS (CCTS_OFLOW | CRTS_IFLOW)
|
||||
|
||||
# define ECHO 0000010
|
||||
# define ECHOE 0000020
|
||||
# define ECHOK 0000040
|
||||
# define ECHONL 0000100
|
||||
# define ICANON 0000002
|
||||
# define IEXTEN 0000400 /* anybody know *what* this does?! */
|
||||
# define ISIG 0000001
|
||||
# define NOFLSH 0000200
|
||||
# define TOSTOP 0001000
|
||||
|
||||
# define VEOF 4 /* also VMIN -- thanks, AT&T */
|
||||
# define VEOL 5 /* also VTIME -- thanks again */
|
||||
# define VERASE 2
|
||||
# define VINTR 0
|
||||
# define VKILL 3
|
||||
# define VMIN 4 /* also VEOF */
|
||||
# define VQUIT 1
|
||||
# define VSUSP 10
|
||||
# define VTIME 5 /* also VEOL */
|
||||
# define VSTART 11
|
||||
# define VSTOP 12
|
||||
|
||||
# define B0 0
|
||||
# define B50 50
|
||||
# define B75 75
|
||||
# define B110 110
|
||||
# define B134 134
|
||||
# define B150 150
|
||||
# define B200 200
|
||||
# define B300 300
|
||||
# define B600 600
|
||||
# define B1200 1200
|
||||
# define B1800 1800
|
||||
# define B2400 2400
|
||||
# define B4800 4800
|
||||
# define B9600 9600
|
||||
# define B19200 19200
|
||||
# define B38400 38400
|
||||
# define B57600 57600
|
||||
# define B115200 115200
|
||||
|
||||
typedef unsigned char cc_t;
|
||||
typedef unsigned short tcflag_t;
|
||||
typedef unsigned long speed_t;
|
||||
|
||||
struct termios {
|
||||
tcflag_t c_iflag;
|
||||
tcflag_t c_oflag;
|
||||
tcflag_t c_cflag;
|
||||
tcflag_t c_lflag;
|
||||
char c_line;
|
||||
cc_t c_cc[NCCS];
|
||||
speed_t c_ispeed;
|
||||
speed_t c_ospeed;
|
||||
};
|
||||
|
||||
# ifndef _NO_MACROS
|
||||
|
||||
# define cfgetospeed(tp) ((tp)->c_ospeed)
|
||||
# define cfgetispeed(tp) ((tp)->c_ispeed)
|
||||
# define cfsetospeed(tp,s) (((tp)->c_ospeed = (s)), 0)
|
||||
# define cfsetispeed(tp,s) (((tp)->c_ispeed = (s)), 0)
|
||||
# define tcdrain(fd) _ioctl (fd, _TCSBRK, 1)
|
||||
# endif /* _NO_MACROS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_TERMIOS_H */
|
||||
|
98
software/signal_processing_bsp/HAL/src/alt_alarm_start.c
Normal file
98
software/signal_processing_bsp/HAL/src/alt_alarm_start.c
Normal file
@ -0,0 +1,98 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2017,2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "sys/alt_alarm.h"
|
||||
#include "sys/alt_irq.h"
|
||||
|
||||
/*
|
||||
* alt_alarm_start is called to register an alarm with the system. The
|
||||
* "alarm" structure passed as an input argument does not need to be
|
||||
* initialised by the user. This is done within this function.
|
||||
*
|
||||
* The remaining input arguments are:
|
||||
*
|
||||
* nticks - The time to elapse until the alarm executes. This is specified in
|
||||
* system clock ticks.
|
||||
* callback - The function to run when the indicated time has elapsed.
|
||||
* context - An opaque value, passed to the callback function.
|
||||
*
|
||||
* Care should be taken when defining the callback function since it is
|
||||
* likely to execute in interrupt context. In particular, this mean that
|
||||
* library calls like printf() should not be made, since they can result in
|
||||
* deadlock.
|
||||
*
|
||||
* The interval to be used for the next callback is the return
|
||||
* value from the callback function. A return value of zero indicates that the
|
||||
* alarm should be unregistered.
|
||||
*
|
||||
* alt_alarm_start() will fail if the timer facility has not been enabled
|
||||
* (i.e. there is no system clock). Failure is indicated by a negative return
|
||||
* value.
|
||||
*/
|
||||
|
||||
int alt_alarm_start (alt_alarm* alarm, alt_u32 nticks,
|
||||
alt_u32 (*callback) (void* context),
|
||||
void* context)
|
||||
{
|
||||
alt_irq_context irq_context;
|
||||
alt_u64 current_nticks = 0;
|
||||
|
||||
if (alt_ticks_per_second ())
|
||||
{
|
||||
if (alarm)
|
||||
{
|
||||
alarm->callback = callback;
|
||||
alarm->context = context;
|
||||
|
||||
irq_context = alt_irq_disable_all ();
|
||||
|
||||
current_nticks = alt_nticks();
|
||||
|
||||
alarm->time = (alt_u64)nticks + current_nticks + 1;
|
||||
|
||||
alt_llist_insert (&alt_alarm_list, &alarm->llist);
|
||||
alt_irq_enable_all (irq_context);
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
}
|
133
software/signal_processing_bsp/HAL/src/alt_busy_sleep.c
Normal file
133
software/signal_processing_bsp/HAL/src/alt_busy_sleep.c
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004 Altera Corporation, San Jose, California, USA.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* ------------
|
||||
*
|
||||
* Altera does not recommend, suggest or require that this reference design
|
||||
* file be used in conjunction or combination with any other product.
|
||||
*
|
||||
* alt_busy_sleep.c - Microsecond delay routine which uses a calibrated busy
|
||||
* loop to perform the delay. This is used to implement
|
||||
* usleep for both uC/OS-II and the standalone HAL.
|
||||
*
|
||||
* Author PRR
|
||||
*
|
||||
* Calibrated delay with no timer required
|
||||
*
|
||||
* The ASM instructions in the routine are equivalent to
|
||||
*
|
||||
* for (i=0;i<us*(ALT_CPU_FREQ/3);i++);
|
||||
*
|
||||
* and takes three cycles each time around the loop
|
||||
*
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "alt_types.h"
|
||||
|
||||
#include "priv/alt_busy_sleep.h"
|
||||
|
||||
unsigned int alt_busy_sleep (unsigned int us)
|
||||
{
|
||||
/*
|
||||
* Only delay if ALT_SIM_OPTIMIZE is not defined; i.e., if software
|
||||
* is built targetting ModelSim RTL simulation, the delay will be
|
||||
* skipped to speed up simulation.
|
||||
*/
|
||||
#ifndef ALT_SIM_OPTIMIZE
|
||||
int i;
|
||||
int big_loops;
|
||||
alt_u32 cycles_per_loop;
|
||||
|
||||
if (!strcmp(NIOS2_CPU_IMPLEMENTATION,"tiny"))
|
||||
{
|
||||
cycles_per_loop = 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
cycles_per_loop = 3;
|
||||
}
|
||||
|
||||
|
||||
big_loops = us / (INT_MAX/
|
||||
(ALT_CPU_FREQ/(cycles_per_loop * 1000000)));
|
||||
|
||||
if (big_loops)
|
||||
{
|
||||
for(i=0;i<big_loops;i++)
|
||||
{
|
||||
/*
|
||||
* Do NOT Try to single step the asm statement below
|
||||
* (single step will never return)
|
||||
* Step out of this function or set a breakpoint after the asm statements
|
||||
*/
|
||||
__asm__ volatile (
|
||||
"\n0:"
|
||||
"\n\taddi %0,%0, -1"
|
||||
"\n\tbne %0,zero,0b"
|
||||
"\n1:"
|
||||
"\n\t.pushsection .debug_alt_sim_info"
|
||||
"\n\t.int 4, 0, 0b, 1b"
|
||||
"\n\t.popsection"
|
||||
:: "r" (INT_MAX));
|
||||
us -= (INT_MAX/(ALT_CPU_FREQ/
|
||||
(cycles_per_loop * 1000000)));
|
||||
}
|
||||
|
||||
/*
|
||||
* Do NOT Try to single step the asm statement below
|
||||
* (single step will never return)
|
||||
* Step out of this function or set a breakpoint after the asm statements
|
||||
*/
|
||||
__asm__ volatile (
|
||||
"\n0:"
|
||||
"\n\taddi %0,%0, -1"
|
||||
"\n\tbne %0,zero,0b"
|
||||
"\n1:"
|
||||
"\n\t.pushsection .debug_alt_sim_info"
|
||||
"\n\t.int 4, 0, 0b, 1b"
|
||||
"\n\t.popsection"
|
||||
:: "r" (us*(ALT_CPU_FREQ/(cycles_per_loop * 1000000))));
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Do NOT Try to single step the asm statement below
|
||||
* (single step will never return)
|
||||
* Step out of this function or set a breakpoint after the asm statements
|
||||
*/
|
||||
__asm__ volatile (
|
||||
"\n0:"
|
||||
"\n\taddi %0,%0, -1"
|
||||
"\n\tbgt %0,zero,0b"
|
||||
"\n1:"
|
||||
"\n\t.pushsection .debug_alt_sim_info"
|
||||
"\n\t.int 4, 0, 0b, 1b"
|
||||
"\n\t.popsection"
|
||||
:: "r" (us*(ALT_CPU_FREQ/(cycles_per_loop * 1000000))));
|
||||
}
|
||||
#endif /* #ifndef ALT_SIM_OPTIMIZE */
|
||||
return 0;
|
||||
}
|
103
software/signal_processing_bsp/HAL/src/alt_close.c
Normal file
103
software/signal_processing_bsp/HAL/src/alt_close.c
Normal file
@ -0,0 +1,103 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "sys/alt_errno.h"
|
||||
#include "sys/alt_warning.h"
|
||||
#include "priv/alt_file.h"
|
||||
#include "os/alt_syscall.h"
|
||||
|
||||
#ifdef ALT_USE_DIRECT_DRIVERS
|
||||
|
||||
int ALT_CLOSE (int fildes)
|
||||
{
|
||||
/* Generate a link time warning, should this function ever be called. */
|
||||
|
||||
ALT_STUB_WARNING(close);
|
||||
|
||||
/* Indicate an error */
|
||||
|
||||
ALT_ERRNO = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else /* !ALT_USE_DIRECT_DRIVERS */
|
||||
|
||||
/*
|
||||
* close() is called by an application to release a file descriptor. If the
|
||||
* associated file system/device has a close() callback function registered
|
||||
* then this called. The file descriptor is then marked as free.
|
||||
*
|
||||
* ALT_CLOSE is mapped onto the close() system call in alt_syscall.h
|
||||
*/
|
||||
|
||||
int ALT_CLOSE (int fildes)
|
||||
{
|
||||
alt_fd* fd;
|
||||
int rval;
|
||||
|
||||
/*
|
||||
* A common error case is that when the file descriptor was created, the call
|
||||
* to open() failed resulting in a negative file descriptor. This is trapped
|
||||
* below so that we don't try and process an invalid file descriptor.
|
||||
*/
|
||||
|
||||
fd = (fildes < 0) ? NULL : &alt_fd_list[fildes];
|
||||
|
||||
if (fd)
|
||||
{
|
||||
/*
|
||||
* If the associated file system/device has a close function, call it so
|
||||
* that any necessary cleanup code can run.
|
||||
*/
|
||||
|
||||
rval = (fd->dev->close) ? fd->dev->close(fd) : 0;
|
||||
|
||||
/* Free the file descriptor structure and return. */
|
||||
|
||||
alt_release_fd (fildes);
|
||||
if (rval < 0)
|
||||
{
|
||||
ALT_ERRNO = -rval;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ALT_ERRNO = EBADFD;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ALT_USE_DIRECT_DRIVERS */
|
70
software/signal_processing_bsp/HAL/src/alt_dcache_flush.c
Normal file
70
software/signal_processing_bsp/HAL/src/alt_dcache_flush.c
Normal file
@ -0,0 +1,70 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003-2005 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "nios2.h"
|
||||
#include "system.h"
|
||||
|
||||
#include "alt_types.h"
|
||||
#include "sys/alt_cache.h"
|
||||
|
||||
#define ALT_FLUSH_DATA(i) __asm__ volatile ("flushda (%0)" :: "r" (i));
|
||||
|
||||
/*
|
||||
* alt_dcache_flush() is called to flush the data cache for a memory
|
||||
* region of length "len" bytes, starting at address "start".
|
||||
*
|
||||
* Any dirty lines in the data cache are written back to memory.
|
||||
*/
|
||||
|
||||
void alt_dcache_flush (void* start, alt_u32 len)
|
||||
{
|
||||
#if NIOS2_DCACHE_SIZE > 0
|
||||
|
||||
char* i;
|
||||
char* end = ((char*) start) + len;
|
||||
|
||||
for (i = start; i < end; i+= NIOS2_DCACHE_LINE_SIZE)
|
||||
{
|
||||
ALT_FLUSH_DATA(i);
|
||||
}
|
||||
|
||||
/*
|
||||
* For an unaligned flush request, we've got one more line left.
|
||||
* Note that this is dependent on NIOS2_DCACHE_LINE_SIZE to be a
|
||||
* multiple of 2 (which it always is).
|
||||
*/
|
||||
|
||||
if (((alt_u32) start) & (NIOS2_DCACHE_LINE_SIZE - 1))
|
||||
{
|
||||
ALT_FLUSH_DATA(i);
|
||||
}
|
||||
|
||||
#endif /* NIOS2_DCACHE_SIZE > 0 */
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003-2005 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "nios2.h"
|
||||
#include "system.h"
|
||||
|
||||
#include "alt_types.h"
|
||||
#include "sys/alt_cache.h"
|
||||
|
||||
/*
|
||||
* alt_dcache_flush_all() is called to flush the entire data cache.
|
||||
*/
|
||||
|
||||
void alt_dcache_flush_all (void)
|
||||
{
|
||||
#if NIOS2_DCACHE_SIZE > 0
|
||||
char* i;
|
||||
|
||||
for (i = (char*) 0; i < (char*) NIOS2_DCACHE_SIZE; i+= NIOS2_DCACHE_LINE_SIZE)
|
||||
{
|
||||
__asm__ volatile ("flushd (%0)" :: "r" (i));
|
||||
}
|
||||
#endif /* NIOS2_DCACHE_SIZE > 0 */
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2007 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "nios2.h"
|
||||
#include "system.h"
|
||||
|
||||
#include "alt_types.h"
|
||||
#include "sys/alt_cache.h"
|
||||
|
||||
#define ALT_FLUSH_DATA_NO_WRITEBACK(i) \
|
||||
__asm__ volatile ("initda (%0)" :: "r" (i));
|
||||
|
||||
/*
|
||||
* alt_dcache_flush_no_writeback() is called to flush the data cache for a
|
||||
* memory region of length "len" bytes, starting at address "start".
|
||||
*
|
||||
* Any dirty lines in the data cache are NOT written back to memory.
|
||||
* Make sure you really want this behavior. If you aren't 100% sure,
|
||||
* use the alt_dcache_flush() routine instead.
|
||||
*/
|
||||
|
||||
void alt_dcache_flush_no_writeback (void* start, alt_u32 len)
|
||||
{
|
||||
char* i;
|
||||
char* end = ((char*) start) + len;
|
||||
|
||||
for (i = start; i < end; i+= NIOS2_DCACHE_LINE_SIZE)
|
||||
{
|
||||
ALT_FLUSH_DATA_NO_WRITEBACK(i);
|
||||
}
|
||||
|
||||
/*
|
||||
* For an unaligned flush request, we've got one more line left.
|
||||
* Note that this is dependent on NIOS2_DCACHE_LINE_SIZE to be a
|
||||
* multiple of 2 (which it always is).
|
||||
*/
|
||||
|
||||
if (((alt_u32) start) & (NIOS2_DCACHE_LINE_SIZE - 1))
|
||||
{
|
||||
ALT_FLUSH_DATA_NO_WRITEBACK(i);
|
||||
}
|
||||
}
|
149
software/signal_processing_bsp/HAL/src/alt_dev.c
Normal file
149
software/signal_processing_bsp/HAL/src/alt_dev.c
Normal file
@ -0,0 +1,149 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "sys/alt_dev.h"
|
||||
#include "priv/alt_file.h"
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
/*
|
||||
* This file contains the data constructs used to control access to device and
|
||||
* filesytems.
|
||||
*/
|
||||
|
||||
/*
|
||||
* "alt_fs_list" is the head of a linked list of registered filesystems. It is
|
||||
* initialised as an empty list. New entries can be added using the
|
||||
* alt_fs_reg() function.
|
||||
*/
|
||||
|
||||
ALT_LLIST_HEAD(alt_fs_list);
|
||||
|
||||
|
||||
/*
|
||||
* "alt_dev_list" is the head of a linked list of registered devices. It is
|
||||
* configured at startup to include a single device, "alt_dev_null". This
|
||||
* device is discussed below.
|
||||
*/
|
||||
|
||||
extern alt_dev alt_dev_null; /* forward declaration */
|
||||
|
||||
alt_llist alt_dev_list = {&alt_dev_null.llist, &alt_dev_null.llist};
|
||||
|
||||
/*
|
||||
* alt_dev_null_write() is the implementation of the write() function used
|
||||
* by the alt_dev_null device. It simple discards all data passed to it, and
|
||||
* indicates that the data has been successfully transmitted.
|
||||
*/
|
||||
|
||||
static int alt_dev_null_write (alt_fd* fd, const char* ptr, int len)
|
||||
{
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
* "alt_dev_null" is used to allow output to be redirected to nowhere. It is
|
||||
* the only device registered before the call to alt_sys_init(). At startup
|
||||
* stin, stdout & stderr are all directed towards this device so that library
|
||||
* calls like printf() will be safe but inefectual.
|
||||
*/
|
||||
|
||||
alt_dev alt_dev_null = {
|
||||
{
|
||||
&alt_dev_list,
|
||||
&alt_dev_list
|
||||
},
|
||||
"/dev/null",
|
||||
NULL, /* open */
|
||||
NULL, /* close */
|
||||
NULL, /* write */
|
||||
alt_dev_null_write, /* write */
|
||||
NULL, /* lseek */
|
||||
NULL, /* fstat */
|
||||
NULL /* ioctl */
|
||||
};
|
||||
|
||||
/*
|
||||
* "alt_fd_list_lock" is a semaphore used to control access to the file
|
||||
* descriptor list. This is used to ensure that access to the list is thread
|
||||
* safe.
|
||||
*/
|
||||
|
||||
ALT_SEM(alt_fd_list_lock)
|
||||
|
||||
/*
|
||||
* "alt_max_fd" is used to make access to the file descriptor list more
|
||||
* efficent. It is set to be the value of the highest allocated file
|
||||
* descriptor. This saves having to search the entire pool of unallocated
|
||||
* file descriptors when looking for a match.
|
||||
*/
|
||||
|
||||
alt_32 alt_max_fd = -1;
|
||||
|
||||
/*
|
||||
* "alt_fd_list" is the file descriptor pool. The first three entries in the
|
||||
* array are configured as standard in, standard out, and standard error. These
|
||||
* are all initialised so that accesses are directed to the alt_dev_null
|
||||
* device. The remaining file descriptors are initialised as unallocated.
|
||||
*
|
||||
* The maximum number of file descriptors within the system is specified by the
|
||||
* user defined macro "ALT_MAX_FD". This is defined in "system.h", which is
|
||||
* auto-genereated using the projects PTF and STF files.
|
||||
*/
|
||||
|
||||
alt_fd alt_fd_list[ALT_MAX_FD] =
|
||||
{
|
||||
{
|
||||
&alt_dev_null, /* standard in */
|
||||
0,
|
||||
0
|
||||
},
|
||||
{
|
||||
&alt_dev_null, /* standard out */
|
||||
0,
|
||||
0
|
||||
},
|
||||
{
|
||||
&alt_dev_null, /* standard error */
|
||||
0,
|
||||
0
|
||||
}
|
||||
/* all other elements are set to zero */
|
||||
};
|
@ -0,0 +1,59 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "priv/alt_dev_llist.h"
|
||||
#include "sys/alt_errno.h"
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
int alt_dev_llist_insert (alt_dev_llist* dev, alt_llist* list)
|
||||
{
|
||||
/*
|
||||
* check that the device exists, and that it has a valid name.
|
||||
*/
|
||||
|
||||
if (!dev || !dev->name)
|
||||
{
|
||||
ALT_ERRNO = EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* register the device.
|
||||
*/
|
||||
|
||||
alt_llist_insert(list, &dev->llist);
|
||||
|
||||
return 0;
|
||||
}
|
63
software/signal_processing_bsp/HAL/src/alt_dma_rxchan_open.c
Normal file
63
software/signal_processing_bsp/HAL/src/alt_dma_rxchan_open.c
Normal file
@ -0,0 +1,63 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "sys/alt_dma.h"
|
||||
#include "sys/alt_errno.h"
|
||||
#include "priv/alt_file.h"
|
||||
|
||||
/*
|
||||
* The list of registered DMA receive channels.
|
||||
*/
|
||||
|
||||
ALT_LLIST_HEAD(alt_dma_rxchan_list);
|
||||
|
||||
/*
|
||||
* alt_dma_txchan_open() is used to obtain an "alt_dma_txchan" descriptor for
|
||||
* a DMA transmit device. The name is the name of the associated physical
|
||||
* device (e.g. "/dev/dma_0").
|
||||
*
|
||||
* The return value will be NULL on failure, and non-NULL otherwise.
|
||||
*/
|
||||
|
||||
alt_dma_rxchan alt_dma_rxchan_open (const char* name)
|
||||
{
|
||||
alt_dma_rxchan dev;
|
||||
|
||||
dev = (alt_dma_rxchan) alt_find_dev (name, &alt_dma_rxchan_list);
|
||||
|
||||
if (!dev)
|
||||
{
|
||||
ALT_ERRNO = ENODEV;
|
||||
}
|
||||
|
||||
return dev;
|
||||
}
|
63
software/signal_processing_bsp/HAL/src/alt_dma_txchan_open.c
Normal file
63
software/signal_processing_bsp/HAL/src/alt_dma_txchan_open.c
Normal file
@ -0,0 +1,63 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "sys/alt_dma.h"
|
||||
#include "sys/alt_errno.h"
|
||||
#include "priv/alt_file.h"
|
||||
|
||||
/*
|
||||
* The list of registered receive channels.
|
||||
*/
|
||||
|
||||
ALT_LLIST_HEAD(alt_dma_txchan_list);
|
||||
|
||||
/*
|
||||
* alt_dma_txchan_open() is used to obtain an "alt_dma_txchan" descriptor for
|
||||
* a DMA transmit device. The name is the name of the associated physical
|
||||
* device (e.g. "/dev/dma_0").
|
||||
*
|
||||
* The return value will be NULL on failure, and non-NULL otherwise.
|
||||
*/
|
||||
|
||||
alt_dma_txchan alt_dma_txchan_open (const char* name)
|
||||
{
|
||||
alt_dma_txchan dev;
|
||||
|
||||
dev = (alt_dma_txchan) alt_find_dev (name, &alt_dma_txchan_list);
|
||||
|
||||
if (!dev)
|
||||
{
|
||||
ALT_ERRNO = ENODEV;
|
||||
}
|
||||
|
||||
return dev;
|
||||
}
|
64
software/signal_processing_bsp/HAL/src/alt_do_ctors.c
Normal file
64
software/signal_processing_bsp/HAL/src/alt_do_ctors.c
Normal file
@ -0,0 +1,64 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT IT DIRECTLY. *
|
||||
* *
|
||||
* Overriding HAL Functions *
|
||||
* *
|
||||
* To provide your own implementation of a HAL function, include the file in *
|
||||
* your Nios II IDE application project. When building the executable, the *
|
||||
* Nios II IDE finds your function first, and uses it in place of the HAL *
|
||||
* version. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
typedef void (*constructor) (void);
|
||||
extern constructor __CTOR_LIST__[];
|
||||
extern constructor __CTOR_END__[];
|
||||
|
||||
/*
|
||||
* Run the C++ static constructors.
|
||||
*/
|
||||
|
||||
void _do_ctors(void)
|
||||
{
|
||||
constructor* ctor;
|
||||
|
||||
for (ctor = &__CTOR_END__[-1]; ctor >= __CTOR_LIST__; ctor--)
|
||||
(*ctor) ();
|
||||
}
|
64
software/signal_processing_bsp/HAL/src/alt_do_dtors.c
Normal file
64
software/signal_processing_bsp/HAL/src/alt_do_dtors.c
Normal file
@ -0,0 +1,64 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT IT DIRECTLY. *
|
||||
* *
|
||||
* Overriding HAL Functions *
|
||||
* *
|
||||
* To provide your own implementation of a HAL function, include the file in *
|
||||
* your Nios II IDE application project. When building the executable, the *
|
||||
* Nios II IDE finds your function first, and uses it in place of the HAL *
|
||||
* version. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
typedef void (*destructor) (void);
|
||||
extern destructor __DTOR_LIST__[];
|
||||
extern destructor __DTOR_END__[];
|
||||
|
||||
/*
|
||||
* Run the C++ static destructors.
|
||||
*/
|
||||
|
||||
void _do_dtors(void)
|
||||
{
|
||||
destructor* dtor;
|
||||
|
||||
for (dtor = &__DTOR_END__[-1]; dtor >= __DTOR_LIST__; dtor--)
|
||||
(*dtor) ();
|
||||
}
|
102
software/signal_processing_bsp/HAL/src/alt_ecc_fatal_entry.S
Normal file
102
software/signal_processing_bsp/HAL/src/alt_ecc_fatal_entry.S
Normal file
@ -0,0 +1,102 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2013 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* This is the code called at the beginning of the exception handler
|
||||
* to detect a likely fatal ECC error exception and then jump to
|
||||
* user-provided code to handle it.
|
||||
*
|
||||
* This code is pulled in from a .globl in alt_ecc_fatal_exception.c.
|
||||
* This scheme is used so that if a handler is never registered, then this
|
||||
* code will not appear in the generated executable, thereby improving
|
||||
* code footprint.
|
||||
*
|
||||
* This code is located in its own section that the linker script
|
||||
* explicitly mentions and ensures it gets linked at the beginning
|
||||
* of the exception handler.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pull in the exception handler register save code.
|
||||
*/
|
||||
.globl alt_exception
|
||||
|
||||
.section .exceptions.entry.ecc_fatal, "xa"
|
||||
|
||||
/*
|
||||
* This might be handling an unrecoverable ECC error exception
|
||||
* in the register file and/or data cache.
|
||||
* Must avoid reading registers or performing load/store instructions
|
||||
* before this is determined because they could trigger another
|
||||
* unrecoverable ECC error exception and create an infinite loop.
|
||||
*
|
||||
* The EXCEPTION register is always present when ECC is present.
|
||||
* Bit 31 of this register indicates that there was an unrecoverable
|
||||
* ECC error exception in the register file and/or data cache.
|
||||
* Test this (using blt to check sign bit) to determine if this is
|
||||
* what we are dealing with. Otherwise, just do normal processing.
|
||||
*
|
||||
* Jump to an application-provided routine to handle this condition.
|
||||
* Pass in the return address in the et register in case this code
|
||||
* can clean up the ECC error and then return here (unlikely).
|
||||
*
|
||||
* Runtime stack checking can't be enabled when ECC is present
|
||||
* because they both want to use the et register.
|
||||
*/
|
||||
rdctl et, exception
|
||||
bge et, r0, alt_exception_not_ecc_fatal /* Not ECCFTL if bit 31 is 0 */
|
||||
|
||||
/*
|
||||
* Load ECC fatal handler pointer into et register.
|
||||
* Using a ldwio is safe because it completely bypasses the data cache.
|
||||
*/
|
||||
movhi et, %hi(alt_exception_ecc_fatal_handler)
|
||||
ori et, et, %lo(alt_exception_ecc_fatal_handler)
|
||||
ldwio et, 0(et)
|
||||
|
||||
/*
|
||||
* If ECC fatal handler pointer is not 0, assume a handler
|
||||
* has been provided by the application.
|
||||
*/
|
||||
beq et, r0, alt_exception_not_ecc_fatal
|
||||
|
||||
/*
|
||||
* The et register contains the address of the ECC fatal handler.
|
||||
* Jump to this address to invoke the handler.
|
||||
*/
|
||||
jmp et
|
||||
|
||||
/*
|
||||
* An ECC fatal handler can jump to this label if it able
|
||||
* to recover from the fatal error (rare) and wants to continue
|
||||
* with normal exception processing.
|
||||
*/
|
||||
.globl alt_exception_not_ecc_fatal
|
||||
alt_exception_not_ecc_fatal:
|
@ -0,0 +1,75 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2013 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
#include "io.h"
|
||||
#include "sys/alt_exceptions.h"
|
||||
#include "sys/alt_cache.h"
|
||||
|
||||
/*
|
||||
* This file implements support for calling a user-registered handler
|
||||
* when a likely fatal ECC error exception occurs.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Global variable containing address to jump to when likely fatal
|
||||
* ECC error exception occurs.
|
||||
*/
|
||||
alt_u32 alt_exception_ecc_fatal_handler = 0x0;
|
||||
|
||||
/*
|
||||
* Pull in the exception entry assembly code. This will not be linked in
|
||||
* unless this object is linked into the executable (i.e. only if
|
||||
* alt_ecc_fatal_exception_register() is called).
|
||||
*/
|
||||
__asm__( "\n\t.globl alt_exception" );
|
||||
|
||||
/*
|
||||
* alt_ecc_fatal_exception_register() is called to register a handler to
|
||||
* service likely fatal ECC error exceptions.
|
||||
*
|
||||
* Passing null (0x0) in the handler argument will disable a previously-
|
||||
* registered handler.
|
||||
*
|
||||
* Note that if no handler is registered, just normal exception processing
|
||||
* occurs on a likely fatal ECC exception and the exception processing
|
||||
* code might trigger an infinite exception loop.
|
||||
*/
|
||||
void
|
||||
alt_ecc_fatal_exception_register(alt_u32 handler)
|
||||
{
|
||||
alt_exception_ecc_fatal_handler = handler;
|
||||
|
||||
/*
|
||||
* Flush this from the cache. Required because the exception handler uses ldwio
|
||||
* to read this value to avoid trigger another data cache ECC error exception.
|
||||
*/
|
||||
alt_dcache_flush(&alt_exception_ecc_fatal_handler, sizeof(alt_exception_ecc_fatal_handler));
|
||||
}
|
53
software/signal_processing_bsp/HAL/src/alt_env_lock.c
Normal file
53
software/signal_processing_bsp/HAL/src/alt_env_lock.c
Normal file
@ -0,0 +1,53 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include <reent.h>
|
||||
|
||||
/*
|
||||
* These are the empty env lock/unlock stubs required by newlib. These are
|
||||
* used to make accesses to environment variables thread safe. The default HAL
|
||||
* configuration is single threaded, so there is nothing to do here. Note that
|
||||
* this requires that environment variables are never manipulated by an interrupt
|
||||
* service routine.
|
||||
*/
|
||||
|
||||
void __env_lock ( struct _reent *_r )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
void __env_unlock ( struct _reent *_r )
|
||||
{
|
||||
}
|
42
software/signal_processing_bsp/HAL/src/alt_environ.c
Normal file
42
software/signal_processing_bsp/HAL/src/alt_environ.c
Normal file
@ -0,0 +1,42 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "os/alt_syscall.h"
|
||||
|
||||
/*
|
||||
* These are the environment variables passed to the C code. By default there
|
||||
* are no variables registered. An application can manipulate this list using
|
||||
* getenv() and setenv().
|
||||
*/
|
||||
|
||||
char *__env[1] = { 0 };
|
||||
char **ALT_ENVIRON = __env;
|
44
software/signal_processing_bsp/HAL/src/alt_errno.c
Normal file
44
software/signal_processing_bsp/HAL/src/alt_errno.c
Normal file
@ -0,0 +1,44 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* This file defines the alt_errno global variable. See comments in
|
||||
* alt_errno.h for the use of this variable.
|
||||
*/
|
||||
|
||||
|
||||
#include "sys/alt_errno.h"
|
||||
#include "alt_types.h"
|
||||
|
||||
extern int ALT_WEAK *__errno (void);
|
||||
|
||||
int* (*alt_errno) (void) = __errno;
|
402
software/signal_processing_bsp/HAL/src/alt_exception_entry.S
Normal file
402
software/signal_processing_bsp/HAL/src/alt_exception_entry.S
Normal file
@ -0,0 +1,402 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003-2008 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "system.h"
|
||||
|
||||
/*
|
||||
* This is the exception entry point code, which saves all the caller saved
|
||||
* registers and then handles the appropriate exception. It should be pulled
|
||||
* in using a .globl from all the exception handler routines. This scheme is
|
||||
* used so that if an interrupt is never registered, then this code will not
|
||||
* appear in the generated executable, thereby improving code footprint.
|
||||
*
|
||||
* If an external interrpt controller (EIC) is present, it will supply an
|
||||
* interrupt vector address to the processor when an interrupt occurs. For
|
||||
* The Altera Vectored Interrupt Controller (VIC) driver will establish a
|
||||
* vector table and the processor will jump directly to the appropriate
|
||||
* table entry, funnel routine, and then user ISR. This will bypass this code
|
||||
* in entirety. This code might still be linked into a system with an EIC,
|
||||
* but would then be used only for non-interrupt exceptions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Explicitly allow the use of r1 (the assembler temporary register)
|
||||
* within this code. This register is normally reserved for the use of
|
||||
* the assembler.
|
||||
*/
|
||||
.set noat
|
||||
|
||||
/*
|
||||
* The top and bottom of the exception stack.
|
||||
*/
|
||||
#ifdef ALT_EXCEPTION_STACK
|
||||
.globl __alt_exception_stack_pointer
|
||||
|
||||
#ifdef ALT_STACK_CHECK
|
||||
.globl __alt_exception_stack_limit
|
||||
|
||||
/*
|
||||
* Store the value of the stack limit after interrupt somewhere.
|
||||
*/
|
||||
.globl alt_exception_old_stack_limit
|
||||
#endif /* ALT_STACK_CHECK */
|
||||
#endif /* ALT_EXCEPTION_STACK */
|
||||
|
||||
/*
|
||||
* The code at alt_exception is located at the Nios II exception
|
||||
* handler address.
|
||||
*/
|
||||
.section .exceptions.entry.label, "xa"
|
||||
.globl alt_exception
|
||||
.type alt_exception, @function
|
||||
alt_exception:
|
||||
|
||||
/*
|
||||
* The code for detecting a likely fatal ECC exception is
|
||||
* linked here before the normal exception handler code if required.
|
||||
* This is handled by the linker script and putting that code
|
||||
* in the .exceptions.entry.ecc_fatal section.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Now start the normal exception handler code.
|
||||
*/
|
||||
.section .exceptions.entry, "xa"
|
||||
|
||||
#ifdef ALT_EXCEPTION_STACK
|
||||
#ifdef ALT_STACK_CHECK
|
||||
/*
|
||||
* When runtime stack checking is enabled, the et register
|
||||
* contains the stack limit. Save this in memory before
|
||||
* overwriting the et register.
|
||||
*/
|
||||
stw et, %gprel(alt_exception_old_stack_limit)(gp)
|
||||
#endif /* ALT_STACK_CHECK */
|
||||
|
||||
/*
|
||||
* Switch to the exception stack and save the current stack pointer
|
||||
* in memory. Uses the et register as a scratch register.
|
||||
*/
|
||||
movhi et, %hi(__alt_exception_stack_pointer - 80)
|
||||
ori et, et, %lo(__alt_exception_stack_pointer - 80)
|
||||
stw sp, 76(et)
|
||||
mov sp, et
|
||||
|
||||
#ifdef ALT_STACK_CHECK
|
||||
/*
|
||||
* Restore the stack limit from memory to the et register.
|
||||
*/
|
||||
movhi et, %hi(__alt_exception_stack_limit)
|
||||
ori et, et, %lo(__alt_exception_stack_limit)
|
||||
stw et, %gprel(alt_stack_limit_value)(gp)
|
||||
#endif /* ALT_STACK_CHECK */
|
||||
|
||||
#else /* ALT_EXCEPTION_STACK disabled */
|
||||
/*
|
||||
* Reserve space on normal stack for registers about to be pushed.
|
||||
*/
|
||||
addi sp, sp, -76
|
||||
|
||||
#ifdef ALT_STACK_CHECK
|
||||
/* Ensure stack didn't just overflow. */
|
||||
bltu sp, et, .Lstack_overflow
|
||||
#endif /* ALT_STACK_CHECK */
|
||||
|
||||
#endif /* ALT_EXCEPTION_STACK */
|
||||
|
||||
/*
|
||||
* Process an exception. For all exceptions we must preserve all
|
||||
* caller saved registers on the stack (See the Nios II ABI
|
||||
* documentation for details).
|
||||
*
|
||||
* Leave a gap in the stack frame at 4(sp) for the muldiv handler to
|
||||
* store zero into.
|
||||
*/
|
||||
stw ra, 0(sp)
|
||||
stw r1, 8(sp)
|
||||
stw r2, 12(sp)
|
||||
stw r3, 16(sp)
|
||||
stw r4, 20(sp)
|
||||
stw r5, 24(sp)
|
||||
stw r6, 28(sp)
|
||||
stw r7, 32(sp)
|
||||
rdctl r5, estatus /* Read early to avoid usage stall */
|
||||
stw r8, 36(sp)
|
||||
stw r9, 40(sp)
|
||||
stw r10, 44(sp)
|
||||
stw r11, 48(sp)
|
||||
stw r12, 52(sp)
|
||||
stw r13, 56(sp)
|
||||
stw r14, 60(sp)
|
||||
stw r15, 64(sp)
|
||||
|
||||
/*
|
||||
* ea-4 contains the address of the instruction being executed
|
||||
* when the exception occured. For interrupt exceptions, we will
|
||||
* will be re-issue the isntruction. Store it in 72(sp)
|
||||
*/
|
||||
stw r5, 68(sp) /* estatus */
|
||||
addi r15, ea, -4 /* instruction that caused exception */
|
||||
stw r15, 72(sp)
|
||||
|
||||
/*
|
||||
* The interrupt testing code (.exceptions.irqtest) will be
|
||||
* linked here. If the Internal Interrupt Controller (IIC) is
|
||||
* present (an EIC is not present), the presense of an interrupt
|
||||
* is determined by examining CPU control registers or an interrupt
|
||||
* custom instruction, if present.
|
||||
*
|
||||
* If the IIC is used and an interrupt is active, the code linked
|
||||
* here will call the HAL IRQ handler (alt_irq_handler()) which
|
||||
* successively calls registered interrupt handler(s) until no
|
||||
* interrupts remain pending. It then jumps to .exceptions.exit. If
|
||||
* there is no interrupt then it continues to .exception.notirq, below.
|
||||
*/
|
||||
|
||||
.section .exceptions.notirq, "xa"
|
||||
|
||||
/*
|
||||
* Prepare to service unimplemtned instructions or traps,
|
||||
* each of which is optionally inked into section .exceptions.soft,
|
||||
* which will preceed .exceptions.unknown below.
|
||||
*
|
||||
* Unlike interrupts, we want to skip the exception-causing instructon
|
||||
* upon completion, so we write ea (address of instruction *after*
|
||||
* the one where the exception occured) into 72(sp). The actual
|
||||
* instruction that caused the exception is written in r2, which these
|
||||
* handlers will utilize.
|
||||
*/
|
||||
stw ea, 72(sp) /* EA is PC+4 so will skip over instruction causing exception */
|
||||
|
||||
#ifdef NIOS2_CDX_PRESENT
|
||||
mov.n r4, ea /* EA contains PC+4 of instruction that caused the exception */
|
||||
subi.n r4, r4, 4 /* Calculate PC */
|
||||
ldhu.n r2, 0(r4) /* Load least-significant 16 bits of instruction */
|
||||
andi r5, r2, 0x7 /* Mask off all bits except the 3 most-significant bits of OP field */
|
||||
|
||||
/*
|
||||
* These instructions compare the MSB 3 bits of OP to 0x1, 0x3, and 0x5
|
||||
* which is where all the 16-bit instructions live.
|
||||
*/
|
||||
subi.n r5, r5, 1
|
||||
beqz.n r5, .Lunknown_16bit
|
||||
subi.n r5, r5, 2
|
||||
beqz.n r5, .Lunknown_16bit
|
||||
subi.n r5, r5, 2
|
||||
beqz.n r5, .Lunknown_16bit
|
||||
|
||||
.Lunknown_32bit:
|
||||
stw ea, 72(sp) /* EA is PC+4 so will skip over instruction causing exception */
|
||||
|
||||
/* Load most-significant 16 bits of instruction */
|
||||
ldhu.n r3, 2(r4)
|
||||
slli.n r3, r3, 16
|
||||
or.n r2, r2, r3 /* 32-bit instruction value that caused exception */
|
||||
br.n .Lunknown_inst_loaded
|
||||
|
||||
.Lunknown_16bit:
|
||||
addi.n r4, r4, 2 /* Need PC+2 to skip over instruction causing exception */
|
||||
stw r4, 72(sp)
|
||||
|
||||
#else /* CDX is not Enabled and all instructions are 32bits */
|
||||
ldw r2, -4(ea) /* Instruction value that caused exception */
|
||||
#endif
|
||||
|
||||
.Lunknown_inst_loaded:
|
||||
|
||||
/*
|
||||
* Other exception handling code, if enabled, will be linked here.
|
||||
* This includes unimplemted (multiply/divide) instruction support
|
||||
* (a BSP generaton option), and a trap handler (that would typically
|
||||
* be augmented with user-specific code). These are not linked in by
|
||||
* default.
|
||||
*/
|
||||
|
||||
/*
|
||||
* In the context of linker sections, "unknown" are all exceptions
|
||||
* not handled by the built-in handlers above (interupt, and trap or
|
||||
* unimplemented instruction decoding, if enabled).
|
||||
*
|
||||
* Advanced exception types can be serviced by registering a handler.
|
||||
* To do so, enable the "Enable Instruction-related Exception API" HAL
|
||||
* BSP setting. If this setting is disabled, this handler code will
|
||||
* either break (if the debug core is present) or enter an infinite
|
||||
* loop because we don't how how to handle the exception.
|
||||
*/
|
||||
.section .exceptions.unknown
|
||||
#ifdef ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API
|
||||
/*
|
||||
* The C-based HAL routine alt_instruction_exception_entry() will
|
||||
* attempt to service the exception by calling a user-registered
|
||||
* exception handler using alt_instruction_exception_register().
|
||||
* If no handler was registered it will either break (if the
|
||||
* debugger is present) or go into an infinite loop since the
|
||||
* handling behavior is undefined; in that case we will not return here.
|
||||
*/
|
||||
|
||||
/* Load exception-causing address as first argument (r4) */
|
||||
addi r4, ea, -4
|
||||
|
||||
/* Call the instruction-exception entry */
|
||||
call alt_instruction_exception_entry
|
||||
|
||||
/*
|
||||
* If alt_instruction_exception_entry() returned, the exception was
|
||||
* serviced by a user-registered routine. Its return code (now in r2)
|
||||
* indicates whether to re-issue or skip the exception-causing
|
||||
* instruction
|
||||
*
|
||||
* Return code was 0: Skip. The instruction after the exception is
|
||||
* already stored in 72(sp).
|
||||
*/
|
||||
bne r2, r0, .Lexception_exit
|
||||
|
||||
/*
|
||||
* Otherwise, modify 72(sp) to re-issue the instruction that caused the
|
||||
* exception.
|
||||
*/
|
||||
addi r15, ea, -4 /* instruction that caused exception */
|
||||
stw r15, 72(sp)
|
||||
|
||||
#else /* ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API disabled */
|
||||
|
||||
/*
|
||||
* We got here because an instruction-related exception occured, but the
|
||||
* handler API was not compiled in. We do not presume to know how to
|
||||
* handle it. If the debugger is present, break, otherwise hang.
|
||||
*
|
||||
* If you get here then one of the following could have happened:
|
||||
*
|
||||
* - An instruction-generated exception occured, and the processor
|
||||
* does not have the extra exceptions feature enabled, or you
|
||||
* have not registered a handler using
|
||||
* alt_instruction_exception_register()
|
||||
*
|
||||
* Some examples of instruction-generated exceptions and why they
|
||||
* might occur:
|
||||
*
|
||||
* - Your program could have been compiled for a full-featured
|
||||
* Nios II core, but it is running on a smaller core, and
|
||||
* instruction emulation has been disabled by defining
|
||||
* ALT_NO_INSTRUCTION_EMULATION.
|
||||
*
|
||||
* You can work around the problem by re-enabling instruction
|
||||
* emulation, or you can figure out why your program is being
|
||||
* compiled for a system other than the one that it is running on.
|
||||
*
|
||||
* - Your program has executed a trap instruction, but has not
|
||||
* implemented a handler for this instruction.
|
||||
*
|
||||
* - Your program has executed an illegal instruction (one which is
|
||||
* not defined in the instruction set).
|
||||
*
|
||||
* - Your processor includes an MMU or MPU, and you have enabled it
|
||||
* before registering an exception handler to service exceptions it
|
||||
* generates.
|
||||
*
|
||||
* The problem could also be hardware related:
|
||||
* - If your hardware is broken and is generating spurious interrupts
|
||||
* (a peripheral which negates its interrupt output before its
|
||||
* interrupt handler has been executed will cause spurious
|
||||
* interrupts)
|
||||
*/
|
||||
alt_exception_unknown:
|
||||
#ifdef NIOS2_HAS_DEBUG_STUB
|
||||
/*
|
||||
* Either tell the user now (if there is a debugger attached) or go into
|
||||
* the debug monitor which will loop until a debugger is attached.
|
||||
*/
|
||||
break
|
||||
#else /* NIOS2_HAS_DEBUG_STUB disabled */
|
||||
/*
|
||||
* If there is no debug stub, an infinite loop is more useful.
|
||||
*/
|
||||
br alt_exception_unknown
|
||||
#endif /* NIOS2_HAS_DEBUG_STUB */
|
||||
#endif /* ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API */
|
||||
|
||||
.section .exceptions.exit.label
|
||||
.Lexception_exit:
|
||||
|
||||
.section .exceptions.exit, "xa"
|
||||
|
||||
/*
|
||||
* Restore the saved registers, so that all general purpose registers
|
||||
* have been restored to their state at the time the interrupt occured.
|
||||
*/
|
||||
|
||||
ldw r5, 68(sp)
|
||||
ldw ea, 72(sp) /* This becomes the PC once eret is executed */
|
||||
ldw ra, 0(sp)
|
||||
|
||||
wrctl estatus, r5
|
||||
|
||||
ldw r1, 8(sp)
|
||||
ldw r2, 12(sp)
|
||||
ldw r3, 16(sp)
|
||||
ldw r4, 20(sp)
|
||||
ldw r5, 24(sp)
|
||||
ldw r6, 28(sp)
|
||||
ldw r7, 32(sp)
|
||||
|
||||
#if defined(ALT_EXCEPTION_STACK) && defined(ALT_STACK_CHECK)
|
||||
ldw et, %gprel(alt_exception_old_stack_limit)(gp)
|
||||
#endif
|
||||
|
||||
ldw r8, 36(sp)
|
||||
ldw r9, 40(sp)
|
||||
ldw r10, 44(sp)
|
||||
ldw r11, 48(sp)
|
||||
ldw r12, 52(sp)
|
||||
ldw r13, 56(sp)
|
||||
ldw r14, 60(sp)
|
||||
ldw r15, 64(sp)
|
||||
|
||||
#ifdef ALT_EXCEPTION_STACK
|
||||
#ifdef ALT_STACK_CHECK
|
||||
stw et, %gprel(alt_stack_limit_value)(gp)
|
||||
stw zero, %gprel(alt_exception_old_stack_limit)(gp)
|
||||
#endif /* ALT_STACK_CHECK */
|
||||
ldw sp, 76(sp)
|
||||
#else /* ALT_EXCEPTION_STACK disabled */
|
||||
addi sp, sp, 76
|
||||
#endif /* ALT_EXCEPTION_STACK */
|
||||
|
||||
/*
|
||||
* Return to the interrupted instruction.
|
||||
*/
|
||||
|
||||
eret
|
||||
|
||||
#ifdef ALT_STACK_CHECK
|
||||
.Lstack_overflow:
|
||||
break 3
|
||||
#endif /* ALT_STACK_CHECK */
|
||||
|
583
software/signal_processing_bsp/HAL/src/alt_exception_muldiv.S
Normal file
583
software/signal_processing_bsp/HAL/src/alt_exception_muldiv.S
Normal file
@ -0,0 +1,583 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003-2005 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* This is the software multiply/divide handler for Nios2.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Provide a label which can be used to pull this file in.
|
||||
*/
|
||||
|
||||
.section .exceptions.start
|
||||
.globl alt_exception_muldiv
|
||||
alt_exception_muldiv:
|
||||
|
||||
/*
|
||||
* Pull in the entry/exit code.
|
||||
*/
|
||||
.globl alt_exception
|
||||
|
||||
|
||||
.section .exceptions.soft, "xa"
|
||||
|
||||
|
||||
/* INSTRUCTION EMULATION
|
||||
* ---------------------
|
||||
*
|
||||
* Nios II processors generate exceptions for unimplemented instructions.
|
||||
* The routines below emulate these instructions. Depending on the
|
||||
* processor core, the only instructions that might need to be emulated
|
||||
* are div, divu, mul, muli, mulxss, mulxsu, and mulxuu.
|
||||
*
|
||||
* The emulations match the instructions, except for the following
|
||||
* limitations:
|
||||
*
|
||||
* 1) The emulation routines do not emulate the use of the exception
|
||||
* temporary register (et) as a source operand because the exception
|
||||
* handler already has modified it.
|
||||
*
|
||||
* 2) The routines do not emulate the use of the stack pointer (sp) or the
|
||||
* exception return address register (ea) as a destination because
|
||||
* modifying these registers crashes the exception handler or the
|
||||
* interrupted routine.
|
||||
*
|
||||
* 3) To save code size, the routines do not emulate the use of the
|
||||
* breakpoint registers (ba and bt) as operands.
|
||||
*
|
||||
* Detailed Design
|
||||
* ---------------
|
||||
*
|
||||
* The emulation routines expect the contents of integer registers r0-r31
|
||||
* to be on the stack at addresses sp, 4(sp), 8(sp), ... 124(sp). The
|
||||
* routines retrieve source operands from the stack and modify the
|
||||
* destination register's value on the stack prior to the end of the
|
||||
* exception handler. Then all registers except the destination register
|
||||
* are restored to their previous values.
|
||||
*
|
||||
* The instruction that causes the exception is found at address -4(ea).
|
||||
* The instruction's OP and OPX fields identify the operation to be
|
||||
* performed.
|
||||
*
|
||||
* One instruction, muli, is an I-type instruction that is identified by
|
||||
* an OP field of 0x24.
|
||||
*
|
||||
* muli AAAAA,BBBBB,IIIIIIIIIIIIIIII,-0x24-
|
||||
* 27 22 6 0 <-- LSB of field
|
||||
*
|
||||
* The remaining emulated instructions are R-type and have an OP field
|
||||
* of 0x3a. Their OPX fields identify them.
|
||||
*
|
||||
* R-type AAAAA,BBBBB,CCCCC,XXXXXX,NNNNN,-0x3a-
|
||||
* 27 22 17 11 6 0 <-- LSB of field
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Split the instruction into its fields. We need 4*A, 4*B, and 4*C as
|
||||
* offsets to the stack pointer for access to the stored register values.
|
||||
*/
|
||||
/* r2 = AAAAA,BBBBB,IIIIIIIIIIIIIIII,PPPPPP */
|
||||
roli r3, r2, 7 /* r3 = BBB,IIIIIIIIIIIIIIII,PPPPPP,AAAAA,BB */
|
||||
roli r4, r3, 3 /* r4 = IIIIIIIIIIIIIIII,PPPPPP,AAAAA,BBBBB */
|
||||
roli r6, r4, 2 /* r6 = IIIIIIIIIIIIII,PPPPPP,AAAAA,BBBBB,II */
|
||||
srai r4, r4, 16 /* r4 = (sign-extended) IMM16 */
|
||||
xori r6, r6, 0x42 /* r6 = CCC,XXXXXX,NNNNN,PPPPPP,AAAAA,bBBBB,cC */
|
||||
roli r7, r6, 5 /* r7 = XXXX,NNNNN,PPPPPP,AAAAA,bBBBB,cCCCC,XX */
|
||||
andi r5, r2, 0x3f /* r5 = 00000000000000000000000000,PPPPPP */
|
||||
xori r3, r3, 0x40
|
||||
andi r3, r3, 0x7c /* r3 = 0000000000000000000000000,aAAAA,00 */
|
||||
andi r6, r6, 0x7c /* r6 = 0000000000000000000000000,bBBBB,00 */
|
||||
andi r7, r7, 0x7c /* r7 = 0000000000000000000000000,cCCCC,00 */
|
||||
|
||||
/* Now either
|
||||
* r5 = OP
|
||||
* r3 = 4*(A^16)
|
||||
* r4 = IMM16 (sign extended)
|
||||
* r6 = 4*(B^16)
|
||||
* r7 = 4*(C^16)
|
||||
* or
|
||||
* r5 = OP
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Save everything on the stack to make it easy for the emulation routines
|
||||
* to retrieve the source register operands. The exception entry code has
|
||||
* already saved some of this so we don't need to do it all again.
|
||||
*/
|
||||
|
||||
addi sp, sp, -60
|
||||
stw zero, 64(sp) /* Save zero on stack to avoid special case for r0. */
|
||||
/* Register at and r2-r15 have already been saved. */
|
||||
|
||||
stw r16, 0(sp)
|
||||
stw r17, 4(sp)
|
||||
stw r18, 8(sp)
|
||||
stw r19, 12(sp)
|
||||
stw r20, 16(sp)
|
||||
stw r21, 20(sp)
|
||||
stw r22, 24(sp)
|
||||
stw r23, 28(sp)
|
||||
/* et @ 32 - Has already been changed.*/
|
||||
/* bt @ 36 - Usually isn't an operand. */
|
||||
stw gp, 40(sp)
|
||||
stw sp, 44(sp)
|
||||
stw fp, 48(sp)
|
||||
/* ea @ 52 - Don't bother to save - it's already been changed */
|
||||
/* ba @ 56 - Breakpoint register usually isn't an operand */
|
||||
/* ra @ 60 - Has already been saved */
|
||||
|
||||
|
||||
/*
|
||||
* Prepare for either multiplication or division loop.
|
||||
* They both loop 32 times.
|
||||
*/
|
||||
movi r14, 32
|
||||
|
||||
|
||||
/*
|
||||
* Get the operands.
|
||||
*
|
||||
* It is necessary to check for muli because it uses an I-type instruction
|
||||
* format, while the other instructions are have an R-type format.
|
||||
*/
|
||||
add r3, r3, sp /* r3 = address of A-operand. */
|
||||
ldw r3, 0(r3) /* r3 = A-operand. */
|
||||
movi r15, 0x24 /* muli opcode (I-type instruction format) */
|
||||
beq r5, r15, .Lmul_immed /* muli doesn't use the B register as a source */
|
||||
|
||||
add r6, r6, sp /* r6 = address of B-operand. */
|
||||
ldw r6, 0(r6) /* r6 = B-operand. */
|
||||
/* r4 = SSSSSSSSSSSSSSSS,-----IMM16------ */
|
||||
/* IMM16 not needed, align OPX portion */
|
||||
/* r4 = SSSSSSSSSSSSSSSS,CCCCC,-OPX--,00000 */
|
||||
srli r4, r4, 5 /* r4 = 00000,SSSSSSSSSSSSSSSS,CCCCC,-OPX-- */
|
||||
andi r4, r4, 0x3f /* r4 = 00000000000000000000000000,-OPX-- */
|
||||
|
||||
/* Now
|
||||
* r5 = OP
|
||||
* r3 = src1
|
||||
* r6 = src2
|
||||
* r4 = OPX (no longer can be muli)
|
||||
* r7 = 4*(C^16)
|
||||
* r14 = loop counter
|
||||
*/
|
||||
|
||||
/* ILLEGAL-INSTRUCTION EXCEPTION
|
||||
* -----------------------------
|
||||
*
|
||||
* This code is for Nios II cores that generate exceptions when attempting
|
||||
* to execute illegal instructions. Nios II cores that support an
|
||||
* illegal-instruction exception are identified by the presence of the
|
||||
* macro definition NIOS2_HAS_ILLEGAL_INSTRUCTION_EXCEPTION in system.h .
|
||||
*
|
||||
* Remember that illegal instructions are different than unimplemented
|
||||
* instructions. Illegal instructions are instruction encodings that
|
||||
* have not been defined by the Nios II ISA. Unimplemented instructions
|
||||
* are legal instructions that must be emulated by some Nios II cores.
|
||||
*
|
||||
* If we get here, all instructions except multiplies and divides
|
||||
* are illegal.
|
||||
*
|
||||
* This code assumes that OP is not muli (because muli was tested above).
|
||||
* All other multiplies and divides are legal. Anything else is illegal.
|
||||
*/
|
||||
|
||||
movi r8, 0x3a /* OP for R-type mul* and div* */
|
||||
bne r5, r8, .Lnot_muldiv
|
||||
|
||||
/* r15 already is 0x24 */ /* OPX of divu */
|
||||
beq r4, r15, .Ldivide
|
||||
|
||||
movi r15,0x27 /* OPX of mul */
|
||||
beq r4, r15, .Lmultiply
|
||||
|
||||
movi r15,0x07 /* OPX of mulxuu */
|
||||
beq r4, r15, .Lmultiply
|
||||
|
||||
movi r15,0x17 /* OPX of mulxsu */
|
||||
beq r4, r15, .Lmultiply
|
||||
|
||||
movi r15,0x1f /* OPX of mulxss */
|
||||
beq r4, r15, .Lmultiply
|
||||
|
||||
movi r15,0x25 /* OPX of div */
|
||||
bne r4, r15, .Lnot_muldiv
|
||||
|
||||
|
||||
/* DIVISION
|
||||
*
|
||||
* Divide an unsigned dividend by an unsigned divisor using
|
||||
* a shift-and-subtract algorithm. The example below shows
|
||||
* 43 div 7 = 6 for 8-bit integers. This classic algorithm uses a
|
||||
* single register to store both the dividend and the quotient,
|
||||
* allowing both values to be shifted with a single instruction.
|
||||
*
|
||||
* remainder dividend:quotient
|
||||
* --------- -----------------
|
||||
* initialize 00000000 00101011:
|
||||
* shift 00000000 0101011:_
|
||||
* remainder >= divisor? no 00000000 0101011:0
|
||||
* shift 00000000 101011:0_
|
||||
* remainder >= divisor? no 00000000 101011:00
|
||||
* shift 00000001 01011:00_
|
||||
* remainder >= divisor? no 00000001 01011:000
|
||||
* shift 00000010 1011:000_
|
||||
* remainder >= divisor? no 00000010 1011:0000
|
||||
* shift 00000101 011:0000_
|
||||
* remainder >= divisor? no 00000101 011:00000
|
||||
* shift 00001010 11:00000_
|
||||
* remainder >= divisor? yes 00001010 11:000001
|
||||
* remainder -= divisor - 00000111
|
||||
* ----------
|
||||
* 00000011 11:000001
|
||||
* shift 00000111 1:000001_
|
||||
* remainder >= divisor? yes 00000111 1:0000011
|
||||
* remainder -= divisor - 00000111
|
||||
* ----------
|
||||
* 00000000 1:0000011
|
||||
* shift 00000001 :0000011_
|
||||
* remainder >= divisor? no 00000001 :00000110
|
||||
*
|
||||
* The quotient is 00000110.
|
||||
*/
|
||||
|
||||
.Ldivide:
|
||||
/*
|
||||
* Prepare for division by assuming the result
|
||||
* is unsigned, and storing its "sign" as 0.
|
||||
*/
|
||||
movi r17, 0
|
||||
|
||||
|
||||
/* Which division opcode? */
|
||||
xori r15, r4, 0x25 /* OPX of div */
|
||||
bne r15, zero, .Lunsigned_division
|
||||
|
||||
|
||||
/*
|
||||
* OPX is div. Determine and store the sign of the quotient.
|
||||
* Then take the absolute value of both operands.
|
||||
*/
|
||||
xor r17, r3, r6 /* MSB contains sign of quotient */
|
||||
bge r3, zero, 0f
|
||||
sub r3, zero, r3 /* -r3 */
|
||||
0:
|
||||
bge r6, zero, 0f
|
||||
sub r6, zero, r6 /* -r6 */
|
||||
0:
|
||||
|
||||
|
||||
.Lunsigned_division:
|
||||
/* Initialize the unsigned-division loop. */
|
||||
movi r13, 0 /* remainder = 0 */
|
||||
|
||||
/* Now
|
||||
* r3 = dividend : quotient
|
||||
* r4 = 0x25 for div, 0x24 for divu
|
||||
* r6 = divisor
|
||||
* r13 = remainder
|
||||
* r14 = loop counter (already initialized to 32)
|
||||
* r17 = MSB contains sign of quotient
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* for (count = 32; count > 0; --count)
|
||||
* {
|
||||
*/
|
||||
.Ldivide_loop:
|
||||
|
||||
/*
|
||||
* Division:
|
||||
*
|
||||
* (remainder:dividend:quotient) <<= 1;
|
||||
*/
|
||||
slli r13, r13, 1
|
||||
cmplt r15, r3, zero /* r15 = MSB of r3 */
|
||||
or r13, r13, r15
|
||||
slli r3, r3, 1
|
||||
|
||||
|
||||
/*
|
||||
* if (remainder >= divisor)
|
||||
* {
|
||||
* set LSB of quotient
|
||||
* remainder -= divisor;
|
||||
* }
|
||||
*/
|
||||
bltu r13, r6, .Ldiv_skip
|
||||
ori r3, r3, 1
|
||||
sub r13, r13, r6
|
||||
.Ldiv_skip:
|
||||
|
||||
/*
|
||||
* }
|
||||
*/
|
||||
subi r14, r14, 1
|
||||
bne r14, zero, .Ldivide_loop
|
||||
|
||||
mov r9, r3
|
||||
|
||||
|
||||
/* Now
|
||||
* r9 = quotient
|
||||
* r4 = 0x25 for div, 0x24 for divu
|
||||
* r7 = 4*(C^16)
|
||||
* r17 = MSB contains sign of quotient
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Conditionally negate signed quotient. If quotient is unsigned,
|
||||
* the sign already is initialized to 0.
|
||||
*/
|
||||
bge r17, zero, .Lstore_result
|
||||
sub r9, zero, r9 /* -r9 */
|
||||
|
||||
br .Lstore_result
|
||||
|
||||
|
||||
|
||||
|
||||
/* MULTIPLICATION
|
||||
*
|
||||
* A "product" is the number that one gets by summing a "multiplicand"
|
||||
* several times. The "multiplier" specifies the number of copies of the
|
||||
* multiplicand that are summed.
|
||||
*
|
||||
* Actual multiplication algorithms don't use repeated addition, however.
|
||||
* Shift-and-add algorithms get the same answer as repeated addition, and
|
||||
* they are faster. To compute the lower half of a product (pppp below)
|
||||
* one shifts the product left before adding in each of the partial products
|
||||
* (a * mmmm) through (d * mmmm).
|
||||
*
|
||||
* To compute the upper half of a product (PPPP below), one adds in the
|
||||
* partial products (d * mmmm) through (a * mmmm), each time following the
|
||||
* add by a right shift of the product.
|
||||
*
|
||||
* mmmm
|
||||
* * abcd
|
||||
* ------
|
||||
* #### = d * mmmm
|
||||
* #### = c * mmmm
|
||||
* #### = b * mmmm
|
||||
* #### = a * mmmm
|
||||
* --------
|
||||
* PPPPpppp
|
||||
*
|
||||
* The example above shows 4 partial products. Computing actual Nios II
|
||||
* products requires 32 partials.
|
||||
*
|
||||
* It is possible to compute the result of mulxsu from the result of mulxuu
|
||||
* because the only difference between the results of these two opcodes is
|
||||
* the value of the partial product associated with the sign bit of rA.
|
||||
*
|
||||
* mulxsu = mulxuu - ((rA < 0) ? rB : 0);
|
||||
*
|
||||
* It is possible to compute the result of mulxss from the result of mulxsu
|
||||
* because the only difference between the results of these two opcodes is
|
||||
* the value of the partial product associated with the sign bit of rB.
|
||||
*
|
||||
* mulxss = mulxsu - ((rB < 0) ? rA : 0);
|
||||
*
|
||||
*/
|
||||
|
||||
.Lmul_immed:
|
||||
/* Opcode is muli. Change it into mul for remainder of algorithm. */
|
||||
mov r7, r6 /* Field B is dest register, not field C. */
|
||||
mov r6, r4 /* Field IMM16 is src2, not field B. */
|
||||
movi r4, 0x27 /* OPX of mul is 0x27 */
|
||||
|
||||
.Lmultiply:
|
||||
/* Initialize the multiplication loop. */
|
||||
movi r9, 0 /* mul_product = 0 */
|
||||
movi r10, 0 /* mulxuu_product = 0 */
|
||||
mov r11, r6 /* save original multiplier for mulxsu and mulxss */
|
||||
mov r12, r6 /* mulxuu_multiplier (will be shifted) */
|
||||
movi r16, 1 /* used to create "rori B,A,1" from "ror B,A,r16" */
|
||||
|
||||
/* Now
|
||||
* r3 = multiplicand
|
||||
* r6 = mul_multiplier
|
||||
* r7 = 4 * dest_register (used later as offset to sp)
|
||||
* r9 = mul_product
|
||||
* r10 = mulxuu_product
|
||||
* r11 = original multiplier
|
||||
* r12 = mulxuu_multiplier
|
||||
* r14 = loop counter (already initialized)
|
||||
* r15 = temp
|
||||
* r16 = 1
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* for (count = 32; count > 0; --count)
|
||||
* {
|
||||
*/
|
||||
.Lmultiply_loop:
|
||||
|
||||
/*
|
||||
* mul_product <<= 1;
|
||||
* lsb = multiplier & 1;
|
||||
*/
|
||||
slli r9, r9, 1
|
||||
andi r15, r12, 1
|
||||
|
||||
/*
|
||||
* if (lsb == 1)
|
||||
* {
|
||||
* mulxuu_product += multiplicand;
|
||||
* }
|
||||
*/
|
||||
beq r15, zero, .Lmulx_skip
|
||||
add r10, r10, r3
|
||||
cmpltu r15, r10, r3 /* Save the carry from the MSB of mulxuu_product. */
|
||||
ror r15, r15, r16 /* r15 = 0x80000000 on carry, or else 0x00000000 */
|
||||
.Lmulx_skip:
|
||||
|
||||
/*
|
||||
* if (MSB of mul_multiplier == 1)
|
||||
* {
|
||||
* mul_product += multiplicand;
|
||||
* }
|
||||
*/
|
||||
bge r6, zero, .Lmul_skip
|
||||
add r9, r9, r3
|
||||
.Lmul_skip:
|
||||
|
||||
/*
|
||||
* mulxuu_product >>= 1; logical shift
|
||||
* mul_multiplier <<= 1; done with MSB
|
||||
* mulx_multiplier >>= 1; done with LSB
|
||||
*/
|
||||
srli r10, r10, 1
|
||||
or r10, r10, r15 /* OR in the saved carry bit. */
|
||||
slli r6, r6, 1
|
||||
srli r12, r12, 1
|
||||
|
||||
|
||||
/*
|
||||
* }
|
||||
*/
|
||||
subi r14, r14, 1
|
||||
bne r14, zero, .Lmultiply_loop
|
||||
|
||||
|
||||
/*
|
||||
* Multiply emulation loop done.
|
||||
*/
|
||||
|
||||
/* Now
|
||||
* r3 = multiplicand
|
||||
* r4 = OPX
|
||||
* r7 = 4 * dest_register (used later as offset to sp)
|
||||
* r9 = mul_product
|
||||
* r10 = mulxuu_product
|
||||
* r11 = original multiplier
|
||||
* r15 = temp
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Select/compute the result based on OPX.
|
||||
*/
|
||||
|
||||
|
||||
/* OPX == mul? Then store. */
|
||||
xori r15, r4, 0x27
|
||||
beq r15, zero, .Lstore_result
|
||||
|
||||
/* It's one of the mulx.. opcodes. Move over the result. */
|
||||
mov r9, r10
|
||||
|
||||
/* OPX == mulxuu? Then store. */
|
||||
xori r15, r4, 0x07
|
||||
beq r15, zero, .Lstore_result
|
||||
|
||||
/* Compute mulxsu
|
||||
*
|
||||
* mulxsu = mulxuu - ((rA < 0) ? rB : 0);
|
||||
*/
|
||||
bge r3, zero, .Lmulxsu_skip
|
||||
sub r9, r9, r11
|
||||
.Lmulxsu_skip:
|
||||
|
||||
/* OPX == mulxsu? Then store. */
|
||||
xori r15, r4, 0x17
|
||||
beq r15, zero, .Lstore_result
|
||||
|
||||
/* Compute mulxss
|
||||
*
|
||||
* mulxss = mulxsu - ((rB < 0) ? rA : 0);
|
||||
*/
|
||||
bge r11, zero, .Lmulxss_skip
|
||||
sub r9, r9, r3
|
||||
.Lmulxss_skip:
|
||||
/* At this point, assume that OPX is mulxss, so store */
|
||||
|
||||
|
||||
.Lstore_result:
|
||||
add r7, r7, sp
|
||||
stw r9, 0(r7)
|
||||
|
||||
ldw r16, 0(sp)
|
||||
ldw r17, 4(sp)
|
||||
ldw r18, 8(sp)
|
||||
ldw r19, 12(sp)
|
||||
ldw r20, 16(sp)
|
||||
ldw r21, 20(sp)
|
||||
ldw r22, 24(sp)
|
||||
ldw r23, 28(sp)
|
||||
|
||||
/* bt @ 32 - Breakpoint register usually isn't an operand. */
|
||||
/* et @ 36 - Don't corrupt et. */
|
||||
/* gp @ 40 - Don't corrupt gp. */
|
||||
/* sp @ 44 - Don't corrupt sp. */
|
||||
ldw fp, 48(sp)
|
||||
/* ea @ 52 - Don't corrupt ea. */
|
||||
/* ba @ 56 - Breakpoint register usually isn't an operand. */
|
||||
|
||||
addi sp, sp, 60
|
||||
|
||||
br .Lexception_exit
|
||||
|
||||
|
||||
.Lnot_muldiv:
|
||||
|
||||
addi sp, sp, 60
|
||||
|
||||
|
||||
.section .exceptions.exit.label
|
||||
.Lexception_exit:
|
||||
|
95
software/signal_processing_bsp/HAL/src/alt_exception_trap.S
Normal file
95
software/signal_processing_bsp/HAL/src/alt_exception_trap.S
Normal file
@ -0,0 +1,95 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003-2005 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* This is the trap exception handler for Nios2.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Provide a label which can be used to pull this file in.
|
||||
*/
|
||||
|
||||
.section .exceptions.start
|
||||
.globl alt_exception_trap
|
||||
alt_exception_trap:
|
||||
|
||||
/*
|
||||
* Pull in the entry/exit code.
|
||||
*/
|
||||
.globl alt_exception
|
||||
|
||||
.section .exceptions.soft, "xa"
|
||||
|
||||
.Ltrap_handler:
|
||||
|
||||
/*
|
||||
* Did a trap instruction cause the exception?
|
||||
*
|
||||
* The instruction which the exception occurred on has been loaded
|
||||
* into r2 by code in alt_exception_entry.S
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ALT_CPU_CPU_ARCH_NIOS2_R2
|
||||
movhi r3,0xb41d /* upper half of trap opcode */
|
||||
ori r3,r3,0x0020 /* lower half of trap opcode */
|
||||
beq r2,r3,.Lis_trap
|
||||
#ifdef NIOS2_CDX_PRESENT
|
||||
mov r3,r2
|
||||
andhi r3,r3,0xffff
|
||||
ori r3,r3,0xd009 /* trap.n opcode */
|
||||
beq r2,r3,.Lis_trap
|
||||
#endif
|
||||
br .Lnot_trap
|
||||
#else
|
||||
movhi r3,0x003b /* upper half of trap opcode */
|
||||
ori r3,r3,0x683a /* lower half of trap opcode */
|
||||
bne r2,r3,.Lnot_trap
|
||||
#endif
|
||||
|
||||
.Lis_trap:
|
||||
/*
|
||||
* There is no trap handler defined here, and so executing a trap
|
||||
* instruction causes a software break. If you provide a trap handler,
|
||||
* then you must replace the break instruction below with your handler.
|
||||
* Your handler must preserve ea and the usual callee saved registers.
|
||||
*/
|
||||
|
||||
break
|
||||
|
||||
br .Lexception_exit
|
||||
|
||||
.Lnot_trap:
|
||||
|
||||
|
||||
.section .exceptions.exit.label
|
||||
.Lexception_exit:
|
||||
|
||||
|
55
software/signal_processing_bsp/HAL/src/alt_execve.c
Normal file
55
software/signal_processing_bsp/HAL/src/alt_execve.c
Normal file
@ -0,0 +1,55 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "sys/alt_errno.h"
|
||||
#include "sys/alt_warning.h"
|
||||
#include "os/alt_syscall.h"
|
||||
|
||||
/*
|
||||
* execve() is used by newlib to launch new processes. This is unsupported in
|
||||
* the HAL environment. However a "do-nothing" implementation is still
|
||||
* provied for newlib compatability.
|
||||
*
|
||||
* ALT_EXECVE is mapped onto the execve() system call in alt_syscall.h
|
||||
*/
|
||||
|
||||
int ALT_EXECVE (char *name, char ** argv, char** env)
|
||||
{
|
||||
/* Generate a link time warning, should this function ever be called. */
|
||||
|
||||
ALT_STUB_WARNING(execve);
|
||||
|
||||
/* Indicate an error */
|
||||
|
||||
ALT_ERRNO = ENOSYS;
|
||||
return -1;
|
||||
}
|
71
software/signal_processing_bsp/HAL/src/alt_exit.c
Normal file
71
software/signal_processing_bsp/HAL/src/alt_exit.c
Normal file
@ -0,0 +1,71 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "sys/alt_irq.h"
|
||||
#include "sys/alt_sim.h"
|
||||
#include "os/alt_hooks.h"
|
||||
#include "os/alt_syscall.h"
|
||||
|
||||
#include "alt_types.h"
|
||||
#include "sys/alt_log_printf.h"
|
||||
/*
|
||||
* _exit() is called by exit() in order to terminate the current process.
|
||||
* Typically this is called when main() completes. It should never return.
|
||||
* Since there is nowhere to go once this process completes, this
|
||||
* implementation simply blocks forever.
|
||||
*
|
||||
* Note that interrupts are not disabled so that execution outside of this
|
||||
* thread is allowed to continue.
|
||||
*
|
||||
* ALT_EXIT is mapped onto the _exit() system call in alt_syscall.h
|
||||
*/
|
||||
|
||||
void ALT_EXIT (int exit_code)
|
||||
{
|
||||
/* ALT_LOG - please see HAL/inc/alt_log_printf.h for details */
|
||||
ALT_LOG_PRINT_BOOT("[alt_exit.c] Entering _exit() function.\r\n");
|
||||
ALT_LOG_PRINT_BOOT("[alt_exit.c] Exit code from main was %d.\r\n",exit_code);
|
||||
/* Stop all other threads */
|
||||
|
||||
ALT_LOG_PRINT_BOOT("[alt_exit.c] Calling ALT_OS_STOP().\r\n");
|
||||
ALT_OS_STOP();
|
||||
|
||||
/* Provide notification to the simulator that we've stopped */
|
||||
|
||||
ALT_LOG_PRINT_BOOT("[alt_exit.c] Calling ALT_SIM_HALT().\r\n");
|
||||
ALT_SIM_HALT(exit_code);
|
||||
|
||||
/* spin forever, since there's no where to go back to */
|
||||
|
||||
ALT_LOG_PRINT_BOOT("[alt_exit.c] Spinning forever.\r\n");
|
||||
while (1);
|
||||
}
|
101
software/signal_processing_bsp/HAL/src/alt_fcntl.c
Normal file
101
software/signal_processing_bsp/HAL/src/alt_fcntl.c
Normal file
@ -0,0 +1,101 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "sys/alt_errno.h"
|
||||
#include "priv/alt_file.h"
|
||||
#include "alt_types.h"
|
||||
#include "os/alt_syscall.h"
|
||||
|
||||
#define ALT_FCNTL_FLAGS_MASK ((alt_u32) (O_APPEND | O_NONBLOCK))
|
||||
|
||||
/*
|
||||
* fcntl() is a limited implementation of the standard fcntl() system call.
|
||||
* It can be used to change the state of the flags associated with an open
|
||||
* file descriptor. Normally these flags are set during the call to
|
||||
* open(). It is anticipated that the main use of this function will be to
|
||||
* change the state of a device from blocking to non-blocking (where this is
|
||||
* supported).
|
||||
*
|
||||
* The input argument "fd" is the file descriptor to be manipulated. "cmd"
|
||||
* is the command to execute. This can be either F_GETFL (return the
|
||||
* current value of the flags) or F_SETFL (set the value of the flags).
|
||||
*
|
||||
* If "cmd" is F_SETFL then the argument "arg" is the new value of flags,
|
||||
* otherwise "arg" is ignored. Only the flags: O_APPEND and O_NONBLOCK
|
||||
* can be updated by a call to fcntl(). All other flags remain
|
||||
* unchanged.
|
||||
*
|
||||
* ALT_FCNTL is mapped onto the fcntl() system call in alt_syscall.h
|
||||
*/
|
||||
|
||||
int ALT_FCNTL (int file, int cmd, ...)
|
||||
{
|
||||
alt_fd* fd;
|
||||
long flags;
|
||||
va_list argp;
|
||||
|
||||
/*
|
||||
* A common error case is that when the file descriptor was created, the call
|
||||
* to open() failed resulting in a negative file descriptor. This is trapped
|
||||
* below so that we don't try and process an invalid file descriptor.
|
||||
*/
|
||||
|
||||
fd = (file < 0) ? NULL : &alt_fd_list[file];
|
||||
|
||||
if (fd)
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
case F_GETFL:
|
||||
return fd->fd_flags & ~((alt_u32) ALT_FD_FLAGS_MASK);
|
||||
case F_SETFL:
|
||||
va_start(argp, cmd);
|
||||
flags = va_arg(argp, long);
|
||||
fd->fd_flags &= ~ALT_FCNTL_FLAGS_MASK;
|
||||
fd->fd_flags |= (flags & ALT_FCNTL_FLAGS_MASK);
|
||||
va_end(argp);
|
||||
return 0;
|
||||
default:
|
||||
ALT_ERRNO = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
ALT_ERRNO = EBADFD;
|
||||
return -1;
|
||||
}
|
75
software/signal_processing_bsp/HAL/src/alt_fd_lock.c
Normal file
75
software/signal_processing_bsp/HAL/src/alt_fd_lock.c
Normal file
@ -0,0 +1,75 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "priv/alt_file.h"
|
||||
|
||||
/*
|
||||
* alt_fd_lock() is called as a consequence of an ioctl call to gain exclusive
|
||||
* access to a device, i.e.:
|
||||
*
|
||||
* ioctl (fd, TIOCEXCL, NULL);
|
||||
*
|
||||
* If there are no other open file descriptors which reference the same
|
||||
* device, then alt_fd_lock() will grant the lock. Further calls to open()
|
||||
* for this device will fail until the lock is released.
|
||||
*
|
||||
* This is done by calling close() for this file descriptor, or by calling:
|
||||
*
|
||||
* ioctl (fd, TIOCNXCL, NULL);
|
||||
*
|
||||
* The return value is zero for success, or negative in the case of failure.
|
||||
*/
|
||||
|
||||
int alt_fd_lock (alt_fd* fd)
|
||||
{
|
||||
int i;
|
||||
int rc = 0;
|
||||
|
||||
ALT_SEM_PEND(alt_fd_list_lock, 0);
|
||||
|
||||
for (i = 0; i < alt_max_fd; i++)
|
||||
{
|
||||
if ((&alt_fd_list[i] != fd) && (alt_fd_list[i].dev == fd->dev))
|
||||
{
|
||||
rc = -EACCES;
|
||||
goto alt_fd_lock_exit;
|
||||
}
|
||||
}
|
||||
fd->fd_flags |= ALT_FD_EXCL;
|
||||
|
||||
alt_fd_lock_exit:
|
||||
|
||||
ALT_SEM_POST(alt_fd_list_lock);
|
||||
return rc;
|
||||
}
|
56
software/signal_processing_bsp/HAL/src/alt_fd_unlock.c
Normal file
56
software/signal_processing_bsp/HAL/src/alt_fd_unlock.c
Normal file
@ -0,0 +1,56 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "priv/alt_file.h"
|
||||
|
||||
/*
|
||||
* alt_fd_unlock() is the inverse of alt_fd_lock(). It is called as a
|
||||
* consequence of a TIOCNXCL ioctl request, e.g:
|
||||
*
|
||||
* ioctl (fd, TIOCNXCL, NULL);
|
||||
*
|
||||
* It enables multiple file descriptors to exist for the same device. This
|
||||
* is normally the case, but it may have been disabled by a previous call to
|
||||
* alt_fd_lock().
|
||||
*
|
||||
* Return zero on sucess, and a negative value on failure.
|
||||
*
|
||||
* The current implementation always succeeds.
|
||||
*/
|
||||
|
||||
int alt_fd_unlock (alt_fd* fd)
|
||||
{
|
||||
fd->fd_flags &= ~ALT_FD_EXCL;
|
||||
return 0;
|
||||
}
|
88
software/signal_processing_bsp/HAL/src/alt_find_dev.c
Normal file
88
software/signal_processing_bsp/HAL/src/alt_find_dev.c
Normal file
@ -0,0 +1,88 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "sys/alt_dev.h"
|
||||
#include "priv/alt_file.h"
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
/*
|
||||
* alt_find_dev() is used by open() in order to locate a previously registered
|
||||
* device with the name "name". The input argument "llist" is a pointer to the
|
||||
* head of the device list to search.
|
||||
*
|
||||
* The return value is a pointer to the matching device, or NULL if there is
|
||||
* no match.
|
||||
*
|
||||
* "name" must be an exact match for the devices registered name for a match to
|
||||
* be found.
|
||||
*/
|
||||
|
||||
alt_dev* alt_find_dev(const char* name, alt_llist* llist)
|
||||
{
|
||||
alt_dev* next = (alt_dev*) llist->next;
|
||||
alt_32 len;
|
||||
|
||||
len = strlen(name) + 1;
|
||||
|
||||
/*
|
||||
* Check each list entry in turn, until a match is found, or we reach the
|
||||
* end of the list (i.e. next winds up pointing back to the list head).
|
||||
*/
|
||||
|
||||
while (next != (alt_dev*) llist)
|
||||
{
|
||||
|
||||
/*
|
||||
* memcmp() is used here rather than strcmp() in order to reduce the size
|
||||
* of the executable.
|
||||
*/
|
||||
|
||||
if (!memcmp (next->name, name, len))
|
||||
{
|
||||
/* match found */
|
||||
|
||||
return next;
|
||||
}
|
||||
next = (alt_dev*) next->llist.next;
|
||||
}
|
||||
|
||||
/* No match found */
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
89
software/signal_processing_bsp/HAL/src/alt_find_file.c
Normal file
89
software/signal_processing_bsp/HAL/src/alt_find_file.c
Normal file
@ -0,0 +1,89 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "sys/alt_dev.h"
|
||||
#include "priv/alt_file.h"
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
/*
|
||||
* alt_find_file() is used by open() in order to locate a previously registered
|
||||
* filesystem that owns that mount point that contains the file named "name".
|
||||
*
|
||||
* The return value is a pointer to the matching filesystem, or NULL if there is
|
||||
* no match.
|
||||
*
|
||||
* A match is considered to have been found if the filesystem name followed by
|
||||
* either '/' or '\0' is the prefix of the filename. For example the filename:
|
||||
* "/myfilesystem/junk.txt" would match: "/myfilesystem", but not: "/myfile".
|
||||
*/
|
||||
|
||||
alt_dev* alt_find_file (const char* name)
|
||||
{
|
||||
alt_dev* next = (alt_dev*) alt_fs_list.next;
|
||||
|
||||
alt_32 len;
|
||||
|
||||
/*
|
||||
* Check each list entry in turn, until a match is found, or we reach the
|
||||
* end of the list (i.e. next winds up pointing back to the list head).
|
||||
*/
|
||||
|
||||
while (next != (alt_dev*) &alt_fs_list)
|
||||
{
|
||||
len = strlen(next->name);
|
||||
|
||||
if (next->name[len-1] == '/')
|
||||
{
|
||||
len -= 1;
|
||||
}
|
||||
|
||||
if (((name[len] == '/') || (name[len] == '\0')) &&
|
||||
!memcmp (next->name, name, len))
|
||||
{
|
||||
/* match found */
|
||||
|
||||
return next;
|
||||
}
|
||||
next = (alt_dev*) next->llist.next;
|
||||
}
|
||||
|
||||
/* No match found */
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
69
software/signal_processing_bsp/HAL/src/alt_flash_dev.c
Normal file
69
software/signal_processing_bsp/HAL/src/alt_flash_dev.c
Normal file
@ -0,0 +1,69 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* Alt_flash.c - Functions to register a flash device to the "generic" flash *
|
||||
* interface *
|
||||
* *
|
||||
* Author PRR *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include <errno.h>
|
||||
#include "sys/alt_llist.h"
|
||||
#include "sys/alt_flash_dev.h"
|
||||
#include "priv/alt_file.h"
|
||||
|
||||
ALT_LLIST_HEAD(alt_flash_dev_list);
|
||||
|
||||
alt_flash_fd* alt_flash_open_dev(const char* name)
|
||||
{
|
||||
alt_flash_dev* dev = (alt_flash_dev*)alt_find_dev(name, &alt_flash_dev_list);
|
||||
|
||||
if ((dev) && dev->open)
|
||||
{
|
||||
return dev->open(dev, name);
|
||||
}
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
void alt_flash_close_dev(alt_flash_fd* fd)
|
||||
{
|
||||
if (fd && fd->close)
|
||||
{
|
||||
fd->close(fd);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
57
software/signal_processing_bsp/HAL/src/alt_fork.c
Normal file
57
software/signal_processing_bsp/HAL/src/alt_fork.c
Normal file
@ -0,0 +1,57 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "sys/alt_warning.h"
|
||||
#include "sys/alt_errno.h"
|
||||
#include "os/alt_syscall.h"
|
||||
|
||||
/*
|
||||
* The fork() system call is used by newlib to create a duplicate copy of the
|
||||
* curent process. This is unsupported in the HAL environment. However a
|
||||
* "do-nothing" implementation is still provied for newlib compatability.
|
||||
*
|
||||
* ALT_FORK is mapped onto the fork() system call in alt_syscall.h
|
||||
*/
|
||||
|
||||
int ALT_FORK (void)
|
||||
{
|
||||
/* Generate a link time warning, should this function ever be called. */
|
||||
|
||||
ALT_STUB_WARNING(fork);
|
||||
|
||||
/* Indicate an error */
|
||||
|
||||
ALT_ERRNO = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
75
software/signal_processing_bsp/HAL/src/alt_fs_reg.c
Normal file
75
software/signal_processing_bsp/HAL/src/alt_fs_reg.c
Normal file
@ -0,0 +1,75 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "sys/alt_dev.h"
|
||||
#include "priv/alt_file.h"
|
||||
|
||||
/*
|
||||
* The alt_fs_reg() function is used to register a file system. Once registered
|
||||
* a device can be accessed using the standard posix calls: open(), read(),
|
||||
* write() etc.
|
||||
*
|
||||
* System behaviour is undefined in the event that a file system is registered
|
||||
* with a name that conflicts with an existing device or file system.
|
||||
*
|
||||
* alt_fs_reg() is not thread safe in the sense that there should be no other
|
||||
* thread using the file system list at the time that alt_dev_reg() is called. In
|
||||
* practice this means that alt_fs_reg() should only be called while operating
|
||||
* in a single threaded mode. The expectation is that it will only be called
|
||||
* by the file system initilisation functions invoked by alt_sys_init(), which in
|
||||
* turn should only be called by the single threaded C startup code.
|
||||
*
|
||||
* A return value of zero indicates success. A negative return value indicates
|
||||
* failure.
|
||||
*/
|
||||
|
||||
int alt_fs_reg (alt_dev* dev)
|
||||
{
|
||||
/*
|
||||
* check that the device has a name.
|
||||
*/
|
||||
|
||||
if (!dev->name)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/*
|
||||
* register the file system.
|
||||
*/
|
||||
|
||||
alt_llist_insert(&alt_fs_list, &dev->llist);
|
||||
|
||||
return 0;
|
||||
}
|
128
software/signal_processing_bsp/HAL/src/alt_fstat.c
Normal file
128
software/signal_processing_bsp/HAL/src/alt_fstat.c
Normal file
@ -0,0 +1,128 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2006 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "sys/alt_dev.h"
|
||||
#include "sys/alt_warning.h"
|
||||
#include "sys/alt_errno.h"
|
||||
#include "priv/alt_file.h"
|
||||
#include "os/alt_syscall.h"
|
||||
|
||||
/*
|
||||
* The fstat() system call is used to obtain information about the capabilities
|
||||
* of an open file descriptor. By default file descriptors are marked as
|
||||
* being character devices. If a device or file system wishes to advertise
|
||||
* alternative capabilities then they can register an fstat() function within
|
||||
* their associated alt_dev structure. This will be called to fill in the
|
||||
* entries in the imput "st" structure.
|
||||
*
|
||||
* This function is provided for compatability with newlib.
|
||||
*
|
||||
* ALT_FSTAT is mapped onto the fstat() system call in alt_syscall.h
|
||||
*/
|
||||
|
||||
#ifdef ALT_USE_DIRECT_DRIVERS
|
||||
|
||||
#include "system.h"
|
||||
|
||||
/*
|
||||
* Provide minimal version that just describes all file descriptors
|
||||
* as character devices for provided stdio devices.
|
||||
*/
|
||||
int ALT_FSTAT (int file, struct stat *st)
|
||||
{
|
||||
switch (file) {
|
||||
#ifdef ALT_STDIN_PRESENT
|
||||
case 0: /* stdin file descriptor */
|
||||
#endif /* ALT_STDIN_PRESENT */
|
||||
#ifdef ALT_STDOUT_PRESENT
|
||||
case 1: /* stdout file descriptor */
|
||||
#endif /* ALT_STDOUT_PRESENT */
|
||||
#ifdef ALT_STDERR_PRESENT
|
||||
case 2: /* stderr file descriptor */
|
||||
#endif /* ALT_STDERR_PRESENT */
|
||||
st->st_mode = _IFCHR;
|
||||
return 0;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if !defined(ALT_STDIN_PRESENT) && !defined(ALT_STDOUT_PRESENT) && !defined(ALT_STDERR_PRESENT)
|
||||
/* Generate a link time warning, should this function ever be called. */
|
||||
ALT_STUB_WARNING(fstat);
|
||||
#endif
|
||||
}
|
||||
|
||||
#else /* !ALT_USE_DIRECT_DRIVERS */
|
||||
|
||||
int ALT_FSTAT (int file, struct stat *st)
|
||||
{
|
||||
alt_fd* fd;
|
||||
|
||||
/*
|
||||
* A common error case is that when the file descriptor was created, the call
|
||||
* to open() failed resulting in a negative file descriptor. This is trapped
|
||||
* below so that we don't try and process an invalid file descriptor.
|
||||
*/
|
||||
|
||||
fd = (file < 0) ? NULL : &alt_fd_list[file];
|
||||
|
||||
if (fd)
|
||||
{
|
||||
/* Call the drivers fstat() function to fill out the "st" structure. */
|
||||
|
||||
if (fd->dev->fstat)
|
||||
{
|
||||
return fd->dev->fstat(fd, st);
|
||||
}
|
||||
|
||||
/*
|
||||
* If no function is provided, mark the fd as belonging to a character
|
||||
* device.
|
||||
*/
|
||||
|
||||
else
|
||||
{
|
||||
st->st_mode = _IFCHR;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ALT_ERRNO = EBADFD;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ALT_USE_DIRECT_DRIVERS */
|
105
software/signal_processing_bsp/HAL/src/alt_get_fd.c
Normal file
105
software/signal_processing_bsp/HAL/src/alt_get_fd.c
Normal file
@ -0,0 +1,105 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "sys/alt_dev.h"
|
||||
#include "priv/alt_file.h"
|
||||
|
||||
#include "alt_types.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
/*
|
||||
* alt_get_fd() is called to allocate a new file descriptor from the file
|
||||
* descriptor pool. If a file descriptor is succesfully allocated, it is
|
||||
* configured to refer to device "dev".
|
||||
*
|
||||
* The return value is the index of the file descriptor structure (i.e.
|
||||
* the offset of the file descriptor within the file descriptor array). A
|
||||
* negative value indicates failure.
|
||||
*/
|
||||
|
||||
int alt_get_fd (alt_dev* dev)
|
||||
{
|
||||
alt_32 i;
|
||||
int rc = -EMFILE;
|
||||
|
||||
/*
|
||||
* Take the alt_fd_list_lock semaphore in order to avoid races when
|
||||
* accessing the file descriptor pool.
|
||||
*/
|
||||
|
||||
ALT_SEM_PEND(alt_fd_list_lock, 0);
|
||||
|
||||
/*
|
||||
* Search through the list of file descriptors, and allocate the first
|
||||
* free descriptor that's found.
|
||||
*
|
||||
* If a free descriptor is found, then the value of "alt_max_fd" is
|
||||
* updated accordingly. "alt_max_fd" is a 'highwater mark' which
|
||||
* indicates the highest file descriptor ever allocated. This is used to
|
||||
* improve efficency when searching the file descriptor list, and
|
||||
* therefore reduce contention on the alt_fd_list_lock semaphore.
|
||||
*/
|
||||
|
||||
for (i = 0; i < ALT_MAX_FD; i++)
|
||||
{
|
||||
if (!alt_fd_list[i].dev)
|
||||
{
|
||||
alt_fd_list[i].dev = dev;
|
||||
if (i > alt_max_fd)
|
||||
{
|
||||
alt_max_fd = i;
|
||||
}
|
||||
rc = i;
|
||||
goto alt_get_fd_exit;
|
||||
}
|
||||
}
|
||||
|
||||
alt_get_fd_exit:
|
||||
|
||||
/*
|
||||
* Release the alt_fd_list_lock semaphore now that we are done with the
|
||||
* file descriptor pool.
|
||||
*/
|
||||
|
||||
ALT_SEM_POST(alt_fd_list_lock);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
70
software/signal_processing_bsp/HAL/src/alt_getchar.c
Normal file
70
software/signal_processing_bsp/HAL/src/alt_getchar.c
Normal file
@ -0,0 +1,70 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2015 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef ALT_USE_DIRECT_DRIVERS
|
||||
#include "system.h"
|
||||
#include "sys/alt_driver.h"
|
||||
#include "sys/alt_stdio.h"
|
||||
#include "priv/alt_file.h"
|
||||
#include "unistd.h"
|
||||
#endif
|
||||
#ifdef ALT_SEMIHOSTING
|
||||
#include "sys/alt_stdio.h"
|
||||
#include "unistd.h"
|
||||
#endif
|
||||
/*
|
||||
* Uses the ALT_DRIVER_READ() macro to call directly to driver if available.
|
||||
* Otherwise, uses newlib provided getchar() routine.
|
||||
*/
|
||||
int
|
||||
alt_getchar(void)
|
||||
{
|
||||
#ifdef ALT_SEMIHOSTING
|
||||
char c;
|
||||
read(STDIN_FILENO,&c,1);
|
||||
return c;
|
||||
#else
|
||||
#ifdef ALT_USE_DIRECT_DRIVERS
|
||||
ALT_DRIVER_READ_EXTERNS(ALT_STDIN_DEV);
|
||||
char c;
|
||||
|
||||
if (ALT_DRIVER_READ(ALT_STDIN_DEV, &c, 1, alt_fd_list[STDIN_FILENO].fd_flags) <= 0) {
|
||||
return -1;
|
||||
}
|
||||
return c;
|
||||
#else
|
||||
return getchar();
|
||||
#endif
|
||||
#endif
|
||||
}
|
47
software/signal_processing_bsp/HAL/src/alt_getpid.c
Normal file
47
software/signal_processing_bsp/HAL/src/alt_getpid.c
Normal file
@ -0,0 +1,47 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "os/alt_syscall.h"
|
||||
|
||||
/*
|
||||
* The getpid() system call is used by newlib to obtain the current process
|
||||
* id. Since there is only ever a single process in the HAL environment,
|
||||
* this just returns a constant.
|
||||
*
|
||||
* ALT_GETPID is mapped onto the getpid() system call in alt_syscall.h
|
||||
*/
|
||||
|
||||
int ALT_GETPID (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
125
software/signal_processing_bsp/HAL/src/alt_gettod.c
Normal file
125
software/signal_processing_bsp/HAL/src/alt_gettod.c
Normal file
@ -0,0 +1,125 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2017,2004 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "sys/alt_alarm.h"
|
||||
#include "alt_types.h"
|
||||
#include "os/alt_syscall.h"
|
||||
|
||||
/*
|
||||
* Macro defining the number of micoseconds in a second.
|
||||
*/
|
||||
|
||||
#define ALT_US (1000000)
|
||||
|
||||
/*
|
||||
* "alt_timezone" and "alt_resettime" are the values of the the reset time and
|
||||
* time zone set through the last call to settimeofday(). By default they are
|
||||
* zero initialised.
|
||||
*/
|
||||
|
||||
struct timezone alt_timezone = {0, 0};
|
||||
struct timeval alt_resettime = {0, 0};
|
||||
|
||||
/*
|
||||
* gettimeofday() can be called to obtain a time structure which indicates the
|
||||
* current "wall clock" time. This is calculated using the elapsed number of
|
||||
* system clock ticks, and the value of "alt_resettime" and "alt_timezone" set
|
||||
* through the last call to settimeofday().
|
||||
*
|
||||
* Warning: if this function is called concurrently with a call to
|
||||
* settimeofday(), the value returned by gettimeofday() will be unreliable.
|
||||
*
|
||||
* ALT_GETTIMEOFDAY is mapped onto the gettimeofday() system call in
|
||||
* alt_syscall.h
|
||||
*/
|
||||
|
||||
|
||||
#if defined (__GNUC__) && (__GNUC__ >= 4)
|
||||
int ALT_GETTIMEOFDAY (struct timeval *ptimeval, void *ptimezone_vptr)
|
||||
{
|
||||
struct timezone *ptimezone = (struct timezone*)ptimezone_vptr;
|
||||
#else
|
||||
int ALT_GETTIMEOFDAY (struct timeval *ptimeval, struct timezone *ptimezone)
|
||||
{
|
||||
#endif
|
||||
|
||||
alt_u64 nticks = alt_nticks ();
|
||||
alt_u32 tick_rate = alt_ticks_per_second ();
|
||||
|
||||
/*
|
||||
* Check to see if the system clock is running. This is indicated by a
|
||||
* non-zero system clock rate. If the system clock is not running, an error
|
||||
* is generated and the contents of "ptimeval" and "ptimezone" are not
|
||||
* updated.
|
||||
*/
|
||||
|
||||
if (tick_rate)
|
||||
{
|
||||
ptimeval->tv_sec = alt_resettime.tv_sec + nticks/tick_rate;
|
||||
ptimeval->tv_usec = alt_resettime.tv_usec +
|
||||
(alt_u32)((nticks*(ALT_US/tick_rate))%ALT_US);
|
||||
|
||||
while(ptimeval->tv_usec < 0) {
|
||||
if (ptimeval->tv_sec <= 0)
|
||||
{
|
||||
ptimeval->tv_sec = 0;
|
||||
ptimeval->tv_usec = 0;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptimeval->tv_sec--;
|
||||
ptimeval->tv_usec += ALT_US;
|
||||
}
|
||||
}
|
||||
|
||||
while(ptimeval->tv_usec >= ALT_US) {
|
||||
ptimeval->tv_sec++;
|
||||
ptimeval->tv_usec -= ALT_US;
|
||||
}
|
||||
|
||||
if (ptimezone)
|
||||
{
|
||||
ptimezone->tz_minuteswest = alt_timezone.tz_minuteswest;
|
||||
ptimezone->tz_dsttime = alt_timezone.tz_dsttime;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
272
software/signal_processing_bsp/HAL/src/alt_gmon.c
Normal file
272
software/signal_processing_bsp/HAL/src/alt_gmon.c
Normal file
@ -0,0 +1,272 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003-2005 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "priv/nios2_gmon_data.h"
|
||||
|
||||
#include "sys/alt_irq.h"
|
||||
#include "sys/alt_alarm.h"
|
||||
|
||||
|
||||
/* Macros */
|
||||
|
||||
/* How large should the bins be which we use to generate the histogram */
|
||||
#define PCSAMPLE_BYTES_PER_BUCKET 32
|
||||
|
||||
#define NIOS2_READ_EA(dest) __asm__ ("mov %0, ea" : "=r" (dest))
|
||||
|
||||
/* The compiler inserts calls to mcount() at the start of
|
||||
* every function call. The structure mcount_fn_arc records t
|
||||
* he return address of the function called (in from_pc)
|
||||
* and the return address of the mcount function
|
||||
* (in self_pc). The number of times this arc is executed is
|
||||
* recorded in the field count.
|
||||
*/
|
||||
struct mcount_fn_arc
|
||||
{
|
||||
struct mcount_fn_arc * next;
|
||||
void * from_pc;
|
||||
unsigned int count;
|
||||
};
|
||||
|
||||
/* We need to maintain a list of pointers to the heads of each adjacency
|
||||
* list so that we can find them when writing out the gmon.out file. Since
|
||||
* we don't know at the start of program execution how many functions will
|
||||
* be called we use a list structure to do this.
|
||||
*/
|
||||
struct mcount_fn_entry
|
||||
{
|
||||
struct mcount_fn_entry * next;
|
||||
void * self_pc;
|
||||
struct mcount_fn_arc * arc_head;
|
||||
};
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
void __mcount_record(void * self_pc, void * from_pc, struct mcount_fn_entry * fn_entry, struct mcount_fn_entry * * fn_head) __attribute__ ((no_instrument_function));
|
||||
|
||||
static __inline__ void * mcount_allocate(unsigned int size) __attribute__ ((no_instrument_function));
|
||||
static int nios2_pcsample_init(void) __attribute__ ((no_instrument_function));
|
||||
static alt_u32 nios2_pcsample(void* alarm) __attribute__ ((no_instrument_function));
|
||||
|
||||
/* global variables */
|
||||
|
||||
/* stext and etext are defined in the linker script */
|
||||
extern char stext[];
|
||||
extern char etext[];
|
||||
|
||||
/* Is the PC sampling stuff enabled yet? */
|
||||
static int pcsample_need_init = 1;
|
||||
|
||||
#define HASH_BUCKETS 64 /* Must be a power of 2 */
|
||||
|
||||
/* This points to the list of adjacency list pointers. */
|
||||
struct mcount_fn_entry * __mcount_fn_head[HASH_BUCKETS];
|
||||
|
||||
/* pointer to the in-memory buffer containing the histogram */
|
||||
static unsigned short* s_pcsamples = 0;
|
||||
|
||||
/* the address of the start and end of text section */
|
||||
static const unsigned int s_low_pc = (unsigned int)stext;
|
||||
static const unsigned int s_high_pc = (unsigned int)etext;
|
||||
|
||||
/* the alarm structure to register for pc sampling */
|
||||
static alt_alarm s_nios2_pcsample_alarm;
|
||||
|
||||
unsigned int alt_gmon_data[GMON_DATA_SIZE] =
|
||||
{
|
||||
0x6e6f6d67, /* "gmon" */
|
||||
GMON_DATA_SIZE,
|
||||
0,
|
||||
(unsigned int)stext,
|
||||
(unsigned int)etext,
|
||||
PCSAMPLE_BYTES_PER_BUCKET,
|
||||
0,
|
||||
(unsigned int)__mcount_fn_head,
|
||||
(unsigned int)(__mcount_fn_head + HASH_BUCKETS)
|
||||
};
|
||||
|
||||
/* This holds the current slab of memory we're allocating out of */
|
||||
static char * mcount_slab_ptr = 0;
|
||||
static int mcount_slab_size = 0;
|
||||
|
||||
#define MCOUNT_SLAB_INCREMENT 1020
|
||||
|
||||
|
||||
/*
|
||||
* We can't use malloc to allocate memory because that's too complicated, and
|
||||
* can't be called at interrupt time. Use the lower level allocator instead
|
||||
* because that's interrupt safe (and because we never free anything).
|
||||
*
|
||||
* For speed, we allocate a block of data at once.
|
||||
*/
|
||||
static __inline__ void * mcount_allocate(unsigned int size)
|
||||
{
|
||||
void * data;
|
||||
|
||||
if (size > mcount_slab_size)
|
||||
{
|
||||
mcount_slab_ptr = sbrk(MCOUNT_SLAB_INCREMENT);
|
||||
mcount_slab_size = MCOUNT_SLAB_INCREMENT;
|
||||
}
|
||||
|
||||
data = mcount_slab_ptr;
|
||||
mcount_slab_ptr += size;
|
||||
mcount_slab_size -= size;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add the arc with the values of frompc and topc given to the graph.
|
||||
* This function might be called at interrupt time so must be able to
|
||||
* cope with reentrancy.
|
||||
*
|
||||
* The fast case, where we have already allocated a function arc, has been
|
||||
* handled by the assmebler code.
|
||||
*/
|
||||
void __mcount_record(void * self_pc, void * from_pc, struct mcount_fn_entry * fn_entry, struct mcount_fn_entry * * fn_head)
|
||||
{
|
||||
alt_irq_context context;
|
||||
struct mcount_fn_arc * arc_entry;
|
||||
|
||||
/* Keep trying to start up the PC sampler until it is running.
|
||||
* (It can't start until the timer is going).
|
||||
*/
|
||||
if (pcsample_need_init)
|
||||
{
|
||||
pcsample_need_init = 0;
|
||||
pcsample_need_init = nios2_pcsample_init();
|
||||
}
|
||||
|
||||
/*
|
||||
* We must disable interrupts around the allocation and the list update to
|
||||
* prevent corruption if the instrumented function is re-entrant.
|
||||
*
|
||||
* It's safe for the code above to be stepping through the chain and be
|
||||
* interrupted by this code modifying it - there is an edge case which will
|
||||
* leave two copies of the same arc on the list (both with count=1), but
|
||||
* this is dealt with on the host.
|
||||
*/
|
||||
context = alt_irq_disable_all();
|
||||
|
||||
if (fn_entry == NULL)
|
||||
{
|
||||
/* Add it to the list of functions we must output later. */
|
||||
fn_entry = (struct mcount_fn_entry *)mcount_allocate(sizeof(struct mcount_fn_entry));
|
||||
|
||||
fn_entry->self_pc = self_pc;
|
||||
fn_entry->arc_head = NULL;
|
||||
|
||||
fn_entry->next = *fn_head;
|
||||
*fn_head = fn_entry;
|
||||
}
|
||||
|
||||
/* We will need a new list entry - if there was a list entry before
|
||||
* then the assembler code would have handled it. */
|
||||
arc_entry = (struct mcount_fn_arc *)mcount_allocate(sizeof(struct mcount_fn_arc));
|
||||
|
||||
arc_entry->from_pc = from_pc;
|
||||
arc_entry->count = 1;
|
||||
|
||||
arc_entry->next = fn_entry->arc_head;
|
||||
fn_entry->arc_head = arc_entry;
|
||||
|
||||
alt_irq_enable_all(context);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nios2_pcsample_init starts profiling.
|
||||
* It is called the first time mcount is called, and on subsequent calls to
|
||||
* mcount until it returns zero. It initializes the pc histogram and turns on
|
||||
* timer driven pc sampling.
|
||||
*/
|
||||
static int nios2_pcsample_init(void)
|
||||
{
|
||||
unsigned int pcsamples_size;
|
||||
|
||||
/* We sample the PC every tick */
|
||||
unsigned int prof_rate = alt_ticks_per_second();
|
||||
if (prof_rate == 0)
|
||||
return 1;
|
||||
|
||||
/* allocate the histogram buffer s_pcsamples */
|
||||
pcsamples_size = (s_high_pc - s_low_pc)/PCSAMPLE_BYTES_PER_BUCKET;
|
||||
s_pcsamples = (unsigned short*)sbrk(pcsamples_size * sizeof(unsigned short));
|
||||
|
||||
if (s_pcsamples != 0)
|
||||
{
|
||||
/* initialize the buffer to zero */
|
||||
memset(s_pcsamples, 0, pcsamples_size * sizeof(unsigned short));
|
||||
|
||||
alt_gmon_data[GMON_DATA_PROFILE_DATA] = (int)s_pcsamples;
|
||||
alt_gmon_data[GMON_DATA_PROFILE_RATE] = prof_rate;
|
||||
|
||||
/* Sample every tick (it's cheap) */
|
||||
alt_alarm_start(&s_nios2_pcsample_alarm, 1, nios2_pcsample, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sample the PC value and store it in the histogram
|
||||
*/
|
||||
static alt_u32 nios2_pcsample(void* context)
|
||||
{
|
||||
unsigned int pc=0;
|
||||
unsigned int bucket;
|
||||
|
||||
/* read the exception return address - this will be
|
||||
* inaccurate if there are nested interrupts but we
|
||||
* assume that this is rare and the inaccuracy will
|
||||
* not be great */
|
||||
NIOS2_READ_EA(pc);
|
||||
|
||||
/*
|
||||
* If we're within the profilable range then increment the relevant
|
||||
* bucket in the histogram
|
||||
*/
|
||||
if (pc >= s_low_pc && pc < s_high_pc && s_pcsamples != 0)
|
||||
{
|
||||
bucket = (pc - s_low_pc)/PCSAMPLE_BYTES_PER_BUCKET;
|
||||
s_pcsamples[bucket]++;
|
||||
}
|
||||
|
||||
/* Sample every tick */
|
||||
return 1;
|
||||
}
|
||||
|
84
software/signal_processing_bsp/HAL/src/alt_icache_flush.c
Normal file
84
software/signal_processing_bsp/HAL/src/alt_icache_flush.c
Normal file
@ -0,0 +1,84 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "nios2.h"
|
||||
#include "system.h"
|
||||
|
||||
#include "alt_types.h"
|
||||
#include "sys/alt_cache.h"
|
||||
|
||||
/*
|
||||
* alt_icache_flush() is called to flush the instruction cache for a memory
|
||||
* region of length "len" bytes, starting at address "start".
|
||||
*/
|
||||
|
||||
void alt_icache_flush (void* start, alt_u32 len)
|
||||
{
|
||||
#if NIOS2_ICACHE_SIZE > 0
|
||||
|
||||
char* i;
|
||||
char* end;
|
||||
|
||||
/*
|
||||
* This is the most we would ever need to flush.
|
||||
*/
|
||||
|
||||
if (len > NIOS2_ICACHE_SIZE)
|
||||
{
|
||||
len = NIOS2_ICACHE_SIZE;
|
||||
}
|
||||
|
||||
end = ((char*) start) + len;
|
||||
|
||||
for (i = start; i < end; i+= NIOS2_ICACHE_LINE_SIZE)
|
||||
{
|
||||
__asm__ volatile ("flushi %0" :: "r" (i));
|
||||
}
|
||||
|
||||
/*
|
||||
* For an unaligned flush request, we've got one more line left.
|
||||
* Note that this is dependent on NIOS2_ICACHE_LINE_SIZE to be a
|
||||
* multiple of 2 (which it always is).
|
||||
*/
|
||||
|
||||
if (((alt_u32) start) & (NIOS2_ICACHE_LINE_SIZE - 1))
|
||||
{
|
||||
__asm__ volatile ("flushi %0" :: "r" (i));
|
||||
}
|
||||
|
||||
/*
|
||||
* Having flushed the cache, flush any stale instructions in the
|
||||
* pipeline
|
||||
*/
|
||||
|
||||
__asm__ volatile ("flushp");
|
||||
|
||||
#endif /* NIOS2_ICACHE_SIZE > 0 */
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "nios2.h"
|
||||
#include "system.h"
|
||||
|
||||
#include "alt_types.h"
|
||||
#include "sys/alt_cache.h"
|
||||
|
||||
/*
|
||||
* alt_icache_flush_all() is called to flush the entire instruction cache.
|
||||
*/
|
||||
|
||||
void alt_icache_flush_all (void)
|
||||
{
|
||||
#if NIOS2_ICACHE_SIZE > 0
|
||||
alt_icache_flush (0, NIOS2_ICACHE_SIZE);
|
||||
#endif
|
||||
}
|
106
software/signal_processing_bsp/HAL/src/alt_iic.c
Normal file
106
software/signal_processing_bsp/HAL/src/alt_iic.c
Normal file
@ -0,0 +1,106 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
#include "system.h"
|
||||
|
||||
/*
|
||||
* This file implements the HAL Enhanced interrupt API for Nios II processors
|
||||
* with an internal interrupt controller (IIC). For most routines, this serves
|
||||
* as a wrapper layer over the legacy interrupt API (which must be used with
|
||||
* the IIC only).
|
||||
*
|
||||
* Use of the enhanced API is recommended so that application and device
|
||||
* drivers are compatible with a Nios II system configured with an external
|
||||
* interrupt controller (EIC), or IIC. This will afford maximum portability.
|
||||
*
|
||||
* If an EIC is present, the EIC device driver must provide these routines,
|
||||
* because their operation will be specific to that EIC type.
|
||||
*/
|
||||
#ifndef NIOS2_EIC_PRESENT
|
||||
#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT
|
||||
|
||||
#include "sys/alt_irq.h"
|
||||
#include "priv/alt_iic_isr_register.h"
|
||||
#include "priv/alt_legacy_irq.h"
|
||||
|
||||
/** @Function Description: This function registers an interrupt handler.
|
||||
* If the function is succesful, then the requested interrupt will be enabled upon
|
||||
* return. Registering a NULL handler will disable the interrupt.
|
||||
* @API Type: External
|
||||
* @param ic_id Ignored.
|
||||
* @param irq IRQ number
|
||||
* @return 0 if successful, else error (-1)
|
||||
*/
|
||||
int alt_ic_isr_register(alt_u32 ic_id, alt_u32 irq, alt_isr_func isr,
|
||||
void *isr_context, void *flags)
|
||||
{
|
||||
return alt_iic_isr_register(ic_id, irq, isr, isr_context, flags);
|
||||
}
|
||||
|
||||
/** @Function Description: This function enables a single interrupt.
|
||||
* @API Type: External
|
||||
* @param ic_id Ignored.
|
||||
* @param irq IRQ number
|
||||
* @return 0 if successful, else error (-1)
|
||||
*/
|
||||
int alt_ic_irq_enable (alt_u32 ic_id, alt_u32 irq)
|
||||
{
|
||||
return alt_irq_enable(irq);
|
||||
}
|
||||
|
||||
/** @Function Description: This function disables a single interrupt.
|
||||
* @API Type: External
|
||||
* @param ic_id Ignored.
|
||||
* @param irq IRQ number
|
||||
* @return 0 if successful, else error (-1)
|
||||
*/
|
||||
int alt_ic_irq_disable(alt_u32 ic_id, alt_u32 irq)
|
||||
{
|
||||
return alt_irq_disable(irq);
|
||||
}
|
||||
|
||||
/** @Function Description: This function to determine if corresponding
|
||||
* interrupt is enabled.
|
||||
* @API Type: External
|
||||
* @param ic_id Ignored.
|
||||
* @param irq IRQ number
|
||||
* @return Zero if corresponding interrupt is disabled and
|
||||
* non-zero otherwise.
|
||||
*/
|
||||
alt_u32 alt_ic_irq_enabled(alt_u32 ic_id, alt_u32 irq)
|
||||
{
|
||||
alt_u32 irq_enabled;
|
||||
|
||||
NIOS2_READ_IENABLE(irq_enabled);
|
||||
|
||||
return (irq_enabled & (1 << irq)) ? 1: 0;
|
||||
}
|
||||
|
||||
#endif /* ALT_ENHANCED_INTERRUPT_API_PRESENT */
|
||||
#endif /* NIOS2_EIC_PRESENT */
|
104
software/signal_processing_bsp/HAL/src/alt_iic_isr_register.c
Normal file
104
software/signal_processing_bsp/HAL/src/alt_iic_isr_register.c
Normal file
@ -0,0 +1,104 @@
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2009 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
#include <errno.h>
|
||||
#include "system.h"
|
||||
|
||||
/*
|
||||
* Provides an interrupt registry mechanism for the any CPUs internal interrupt
|
||||
* controller (IIC) when the enhanced interrupt API is active.
|
||||
*/
|
||||
#ifndef ALT_CPU_EIC_PRESENT
|
||||
#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT
|
||||
|
||||
#include "alt_types.h"
|
||||
#include "sys/alt_irq.h"
|
||||
#include "priv/alt_iic_isr_register.h"
|
||||
|
||||
/*
|
||||
* The header, alt_irq_entry.h, contains the exception entry point, and is
|
||||
* provided by the processor component. It is included here, so that the code
|
||||
* will be added to the executable only if alt_irq_register() is present, i.e.
|
||||
* if no interrupts are registered - there's no need to provide any
|
||||
* interrupt handling.
|
||||
*/
|
||||
|
||||
#include "sys/alt_irq_entry.h"
|
||||
|
||||
/*
|
||||
* The header, alt_irq_table.h contains a table describing which function
|
||||
* handles each interrupt.
|
||||
*/
|
||||
|
||||
#include "priv/alt_irq_table.h"
|
||||
|
||||
/** @Function Description: This function registers an interrupt handler.
|
||||
* If the function is succesful, then the requested interrupt will be enabled
|
||||
* upon return. Registering a NULL handler will disable the interrupt.
|
||||
*
|
||||
* @API Type: External
|
||||
* @param ic_id Interrupt controller ID
|
||||
* @param irq IRQ ID number
|
||||
* @param isr Pointer to interrupt service routine
|
||||
* @param isr_context Opaque pointer passed to ISR
|
||||
* @param flags
|
||||
* @return 0 if successful, else error (-1)
|
||||
*/
|
||||
int alt_iic_isr_register(alt_u32 ic_id, alt_u32 irq, alt_isr_func isr,
|
||||
void *isr_context, void *flags)
|
||||
{
|
||||
int rc = -EINVAL;
|
||||
int id = irq; /* IRQ interpreted as the interrupt ID. */
|
||||
alt_irq_context status;
|
||||
|
||||
if (id < ALT_NIRQ)
|
||||
{
|
||||
/*
|
||||
* interrupts are disabled while the handler tables are updated to ensure
|
||||
* that an interrupt doesn't occur while the tables are in an inconsistant
|
||||
* state.
|
||||
*/
|
||||
|
||||
status = alt_irq_disable_all();
|
||||
|
||||
alt_irq[id].handler = isr;
|
||||
alt_irq[id].context = isr_context;
|
||||
|
||||
rc = (isr) ? alt_ic_irq_enable(ic_id, id) : alt_ic_irq_disable(ic_id, id);
|
||||
|
||||
alt_irq_enable_all(status);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
#endif /* ALT_ENHANCED_INTERRUPT_API_PRESENT */
|
||||
#endif /* ALT_CPU_EIC_PRESENT */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user