1 |
2 |
sshuv2 |
|
2 |
|
|
--==============================================================================
|
3 |
|
|
-- |
|
4 |
|
|
-- Project: IIC Multiple Bus Controller (IICMB) |
|
5 |
|
|
-- |
|
6 |
|
|
-- Module: Package for internal declarations. |
|
7 |
|
|
-- Version: |
|
8 |
|
|
-- 1.0, April 29, 2016 |
|
9 |
|
|
-- |
|
10 |
|
|
-- Author: Sergey Shuvalkin, (sshuv2@opencores.org) |
|
11 |
|
|
-- |
|
12 |
|
|
--==============================================================================
|
13 |
|
|
--==============================================================================
|
14 |
|
|
-- Copyright (c) 2016, Sergey Shuvalkin |
|
15 |
|
|
-- All rights reserved. |
|
16 |
|
|
-- |
|
17 |
|
|
-- Redistribution and use in source and binary forms, with or without |
|
18 |
|
|
-- modification, are permitted provided that the following conditions are met: |
|
19 |
|
|
-- |
|
20 |
|
|
-- 1. Redistributions of source code must retain the above copyright notice, |
|
21 |
|
|
-- this list of conditions and the following disclaimer. |
|
22 |
|
|
-- 2. Redistributions in binary form must reproduce the above copyright |
|
23 |
|
|
-- notice, this list of conditions and the following disclaimer in the |
|
24 |
|
|
-- documentation and/or other materials provided with the distribution. |
|
25 |
|
|
-- |
|
26 |
|
|
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
27 |
|
|
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
28 |
|
|
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
29 |
|
|
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
|
30 |
|
|
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
31 |
|
|
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
32 |
|
|
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
33 |
|
|
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
34 |
|
|
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
35 |
|
|
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
36 |
|
|
-- POSSIBILITY OF SUCH DAMAGE. |
|
37 |
|
|
--==============================================================================
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
library ieee;
|
41 |
|
|
use ieee.std_logic_1164.all;
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
--==============================================================================
|
45 |
|
|
package iicmb_int_pkg is
|
46 |
|
|
|
47 |
|
|
------------------------------------------------------------------------------
|
48 |
|
|
-- Bit-level master mode commands:
|
49 |
|
|
------------------------------------------------------------------------------
|
50 |
|
|
type mbc_type is
|
51 |
|
|
(
|
52 |
|
|
mbc_start, -- Start --> Done | Arbitration Lost
|
53 |
|
|
mbc_stop, -- Stop --> Done
|
54 |
|
|
mbc_write_0, -- Write Bit 0 --> Done | Error
|
55 |
|
|
mbc_write_1, -- Write Bit 1 --> Done | Arbitration Lost | Error
|
56 |
|
|
mbc_read -- Read Bit --> Bit 0 Received | Bit 1 Received | Error
|
57 |
|
|
);
|
58 |
|
|
------------------------------------------------------------------------------
|
59 |
|
|
|
60 |
|
|
------------------------------------------------------------------------------
|
61 |
|
|
-- Bit-level master mode responses:
|
62 |
|
|
------------------------------------------------------------------------------
|
63 |
|
|
type mbr_type is
|
64 |
|
|
(
|
65 |
|
|
mbr_done, -- Done
|
66 |
|
|
mbr_arb_lost, -- Arbitration Lost
|
67 |
|
|
mbr_bit_0, -- Bit 0 Received
|
68 |
|
|
mbr_bit_1, -- Bit 1 Received
|
69 |
|
|
mbr_error -- Error
|
70 |
|
|
);
|
71 |
|
|
------------------------------------------------------------------------------
|
72 |
|
|
|
73 |
|
|
------------------------------------------------------------------------------
|
74 |
|
|
-- Bit-level slave mode commands:
|
75 |
|
|
------------------------------------------------------------------------------
|
76 |
|
|
type sbc_type is
|
77 |
|
|
(
|
78 |
|
|
sbc_idle, -- Idle
|
79 |
|
|
sbc_hold, -- Clock stretching
|
80 |
|
|
sbc_write_0, -- Write Bit 0
|
81 |
|
|
sbc_write_1, -- Write Bit 1
|
82 |
|
|
sbc_read -- Read Bit
|
83 |
|
|
);
|
84 |
|
|
------------------------------------------------------------------------------
|
85 |
|
|
|
86 |
|
|
------------------------------------------------------------------------------
|
87 |
|
|
-- Bit-level slave mode responses:
|
88 |
|
|
------------------------------------------------------------------------------
|
89 |
|
|
type sbr_type is
|
90 |
|
|
(
|
91 |
|
|
sbr_start, -- Start
|
92 |
|
|
sbr_stop, -- Stop
|
93 |
|
|
sbr_bit_0, -- Bit 0 received
|
94 |
|
|
sbr_bit_1 -- Bit 1 received
|
95 |
|
|
);
|
96 |
|
|
------------------------------------------------------------------------------
|
97 |
|
|
|
98 |
|
|
end package iicmb_int_pkg;
|
99 |
|
|
--==============================================================================
|
100 |
|
|
|
101 |
|
|
--==============================================================================
|
102 |
|
|
package body iicmb_int_pkg is
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
end package body iicmb_int_pkg;
|
106 |
|
|
--==============================================================================
|
107 |
|
|
|