Compare commits
16
Commits
c5df01f33d
...
Zynq
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35a0e478db | ||
|
|
bd80ce4611 | ||
|
|
4d9b811648 | ||
|
|
930edf4542 | ||
|
|
90849addb7 | ||
|
|
3b268f6583 | ||
|
|
2dca3709ef | ||
|
|
74cd2ae192 | ||
|
|
e61e9d48ad | ||
|
|
63e1fdcdf1 | ||
|
|
99ef0f0e6e | ||
|
|
7f43729caf | ||
|
|
13611d20a0 | ||
|
|
7096f94f47 | ||
|
|
248a54b777 | ||
|
|
79d5a810dc |
+14
-4
@@ -115,6 +115,8 @@ work/
|
|||||||
*.gen/
|
*.gen/
|
||||||
*.tmp/
|
*.tmp/
|
||||||
*.data/
|
*.data/
|
||||||
|
# *.metadata/ 已移除 — Vitis 工作区需要追踪 .metadata 中的项目列表
|
||||||
|
# Vitis workspace 的 .metadata/ 由 2.FW/Zynq/proj_cal/Vitis/.gitignore 精细管理
|
||||||
|
|
||||||
# Vivado 独立目录
|
# Vivado 独立目录
|
||||||
.Xil/
|
.Xil/
|
||||||
@@ -136,14 +138,10 @@ synth_1/
|
|||||||
# Vitis 产物
|
# Vitis 产物
|
||||||
*.fsbl
|
*.fsbl
|
||||||
*.ssbl
|
*.ssbl
|
||||||
*.bit.bin
|
|
||||||
*.hdf
|
*.hdf
|
||||||
*.xsa
|
|
||||||
*.mss
|
*.mss
|
||||||
*.elf
|
|
||||||
|
|
||||||
# Vivado 其他
|
# Vivado 其他
|
||||||
*.bin
|
|
||||||
*.mcs
|
*.mcs
|
||||||
*.prm
|
*.prm
|
||||||
*.rbt
|
*.rbt
|
||||||
@@ -173,6 +171,9 @@ webtalk*.jou
|
|||||||
webtalk*.log
|
webtalk*.log
|
||||||
usage_statistics_webtalk.*
|
usage_statistics_webtalk.*
|
||||||
|
|
||||||
|
# Reserved device names on Windows (breaks git clone on Windows)
|
||||||
|
nul
|
||||||
|
|
||||||
# ===========================
|
# ===========================
|
||||||
# 明确保留的文件(放在最后,覆盖上面的忽略规则)
|
# 明确保留的文件(放在最后,覆盖上面的忽略规则)
|
||||||
# ===========================
|
# ===========================
|
||||||
@@ -193,6 +194,15 @@ usage_statistics_webtalk.*
|
|||||||
# 位流和编程文件
|
# 位流和编程文件
|
||||||
!*.bit
|
!*.bit
|
||||||
!*.jed
|
!*.jed
|
||||||
|
!*.xsa
|
||||||
|
|
||||||
|
# Vitis输出文件
|
||||||
|
!*.bin
|
||||||
|
!*.elf
|
||||||
|
|
||||||
|
# 源代码
|
||||||
|
!*.c
|
||||||
|
!*.h
|
||||||
|
|
||||||
# 手写脚本
|
# 手写脚本
|
||||||
!*.py
|
!*.py
|
||||||
|
|||||||
@@ -0,0 +1,328 @@
|
|||||||
|
# NewCalBoard_DIG_SYY
|
||||||
|
|
||||||
|
> Extracted from `NewCalBoard_DIG_SYY.xlsx`
|
||||||
|
|
||||||
|
- **File size:** 38,819 bytes (37.9 KB)
|
||||||
|
- **Total sheets:** 6
|
||||||
|
|
||||||
|
## Sheet Summary
|
||||||
|
|
||||||
|
| # | Sheet Name | Rows | Columns | Merged Cells | Data Rows |
|
||||||
|
|---|-----------|------|---------|-------------|----------|
|
||||||
|
| 1 | Notes | 6 | 3 | 0 | 5 |
|
||||||
|
| 2 | CPLD_REG | 35 | 42 | 39 | 12 |
|
||||||
|
| 3 | ARM_CPLD | 36 | 7 | 0 | 34 |
|
||||||
|
| 4 | Freq_CPLD | 57 | 8 | 0 | 57 |
|
||||||
|
| 5 | Freq_Output | 20 | 18 | 19 | 17 |
|
||||||
|
| 6 | PMU_CH_Sel | 133 | 26 | 98 | 129 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sheet: `Notes`
|
||||||
|
|
||||||
|
- **Dimensions:** 6 rows x 3 columns
|
||||||
|
- **Merged cell ranges:** 0
|
||||||
|
|
||||||
|
| SCLK_S03定义错误 | | |
|
||||||
|
|---|---|---|---|---|
|
||||||
|
| Zynq与CPLD互连线冲突 | 1_B5_31 | TPL241A & 5522 |
|
||||||
|
| | 2_B2_35 | ARM & ULN |
|
||||||
|
| | 2_B2_38 | ARM & ULN |
|
||||||
|
| | 3_B2_56 | ARM & ADG |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sheet: `CPLD_REG`
|
||||||
|
|
||||||
|
- **Dimensions:** 35 rows x 42 columns
|
||||||
|
- **Merged cell ranges:** 39
|
||||||
|
|
||||||
|
| Addr[7:0] | | | | Data[23:0] | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
|
||||||
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||
|
| MSB | | | LSB | MSB(bit23) | | | | | | | | | | | | bit11 | | bit9 | | | | | | | | bit1 | LSB(bit0) | | | | | | | | | | | | | | |
|
||||||
|
| W(1)/R(0) | 0 (IDENT) | | | CPLD3 | CPLD2 | CPLD1 | Reserved | | | | | | | | | Major Version | | | | Minor Version | | | | Reversion | | | | | | | | | | | | | | | | | |
|
||||||
|
| W(1)/R(0) | 1 (STATE) | | | RDY | Reserved | | | | | | | | | | | | | | | | | | | | | | EXEC | Level1(MSB) | | Level2 | | | | Level3(LSB) | | | | | | | |
|
||||||
|
| W(1)/R(0) | 2 (Freq_Slot1) | | | Per Relay_Control (1 to Switch/0 to Not Switch) | | | | | | | | | | | | | | Channel_Number | | | | | | | | | Slot_EN(1 to EN) | RC_F1 | RC_F2 | RC_S1 | RC_S2 | RC_S3 | RC_S4 | RC_T1 | RC_T2 | RC_T3 | RC_T4 | RC_T5 | RC_T6 | RC_T7 | RC_T8 |
|
||||||
|
| W(1)/R(0) | 3 (Freq_Slot2) | | | Per Relay_Control (1 to Switch/0 to Not Switch) | | | | | | | | | | | | | | Channel_Number | | | | | | | | | Slot_EN(1 to EN) | RC_F3 | RC_F4 | RC_S5 | RC_S6 | RC_S7 | RC_S8 | RC_T9 | RC_T10 | RC_T11 | RC_T12 | RC_T13 | RC_T14 | RC_T15 | RC_T16 |
|
||||||
|
| W(1)/R(0) | 4 (Freq_Slot3) | | | Per Relay_Control (1 to Switch/0 to Not Switch) | | | | | | | | | | | | | | Channel_Number | | | | | | | | | Slot_EN(1 to EN) | RC_F5 | RC_F6 | RC_S9 | RC_S10 | RC_S11 | RC_S12 | RC_T17 | RC_T18 | RC_T19 | RC_T20 | RC_T21 | RC_T22 | RC_T23 | RC_T24 |
|
||||||
|
| W(1)/R(0) | 5 (Freq_Slot4) | | | Per Relay_Control (1 to Switch/0 to Not Switch) | | | | | | | | | | | | | | Channel_Number | | | | | | | | | Slot_EN(1 to EN) | RC_F7 | RC_F8 | RC_S13 | RC_S14 | RC_S15 | RC_S16 | RC_T25 | RC_T26 | RC_T27 | RC_T28 | RC_T29 | RC_T30 | RC_T31 | RC_T32 |
|
||||||
|
| W(1)/R(0) | 6 (DC_Slot1) | | | PMU(0)/DPS(1) | V(0)/I(1) | Rload_Sel | | | | | Reserved | | | | | | | Channel_Number | | | | | | | | | Slot_EN(1 to EN) | | | | | | | | | | | | | | |
|
||||||
|
| W(1)/R(1) | 7 (DC_Slot2) | | | PMU(0)/DPS(1) | V(0)/I(1) | Rload_Sel | | | | | Reserved | | | | | | | Channel_Number | | | | | | | | | Slot_EN(1 to EN) | | | | | | | | | | | | | | |
|
||||||
|
| W(1)/R(2) | 8 (DC_Slot3) | | | PMU(0)/DPS(1) | V(0)/I(1) | Rload_Sel | | | | | Reserved | | | | | | | Channel_Number | | | | | | | | | Slot_EN(1 to EN) | | | | | | | | | | | | | | |
|
||||||
|
| W(1)/R(3) | 9 (DC_Slot4) | | | PMU(0)/DPS(1) | V(0)/I(1) | Rload_Sel | | | | | Reserved | | | | | | | Channel_Number | | | | | | | | | Slot_EN(1 to EN) | | | | | | | | | | | | | | |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sheet: `ARM_CPLD`
|
||||||
|
|
||||||
|
- **Dimensions:** 36 rows x 7 columns
|
||||||
|
- **Merged cell ranges:** 0
|
||||||
|
|
||||||
|
| SIG | ARM | DIR(Zynq) | CPLD | | | |
|
||||||
|
|---|---|---|---|---|---|---|---|---|
|
||||||
|
| RVAILD | B13_L15P_AF19 | | 1_B2_56 | AA16 | | OPTIONAL |
|
||||||
|
| CLK | B13_L9P_AB21 | | 1_B2_35 | AA10 | | |
|
||||||
|
| ERR | B13_L16N_AE21 | | 1_B2_55 | AB16 | | |
|
||||||
|
| MOSI | B13_L19N_Y20 | | 1_B2_39 | AB12 | | |
|
||||||
|
| WREADY | B13_L16P_AE20 | | 1_B2_54 | Y15 | | |
|
||||||
|
| RST_N | B13_L18N_AF18 | | 1_B2_47 | Y14 | | |
|
||||||
|
| RREADY | B13_L17P_AD18 | | 1_B2_48 | AB15 | | |
|
||||||
|
| WVAILD | B13_L17N_AD19 | | 1_B2_53 | AA15 | | |
|
||||||
|
| MISO | B13_L18P_AE18 | | 1_B2_44 | AA14 | | |
|
||||||
|
| CS | B13_L19P_W20 | | 1_B2_38 | AB11 | | |
|
||||||
|
| | B13_L10P_AA22 | | 1_XO2_CLK2_0 | AA9 | | |
|
||||||
|
| ERR | B13_L1P_AA25 | | 2_B2_55 | AB16 | | |
|
||||||
|
| CLK | B13_L1N_AB25 | | 2_B2_56 | AA16 | | |
|
||||||
|
| CS | B13_L11P_AD23 | | 2_B2_54 | Y15 | | |
|
||||||
|
| WVAILD | B13_L11N_AD24 | | 2_B2_53 | AA15 | | |
|
||||||
|
| RST_N | B13_L12P_AC23 | | 2_B2_47 | Y14 | | |
|
||||||
|
| MOSI | B13_L13P_AD20 | | 2_B2_39 | AB12 | | |
|
||||||
|
| RVAILD | B13_L12N_AC24 | | 2_B2_48 | AB15 | | |
|
||||||
|
| RREADY | B13_L14P_AC21 | | 2_B2_35 | AA10 | 2_B2_35同时连到ARM & ULN | |
|
||||||
|
| MISO | B13_L13N_AD21 | | 2_B2_44 | AA14 | | |
|
||||||
|
| WREADY | B13_L14N_AC22 | | 2_B2_38 | AB11 | 2_B2_38同时连到ARM & ULN | |
|
||||||
|
| | B13_L15N_AF20 | | 2_XO2_CLK2_0 | AA9 | | |
|
||||||
|
| ERR | B12_L10P_AE13 | | 3_B2_55 | AB16 | | |
|
||||||
|
| RVAILD | B12_L10N_AF13 | | 3_B2_56 | AA16 | 3_B2_56同时连到ARM & ADG | |
|
||||||
|
| WREADY | B12_L9P_AE11 | | 3_B2_54 | Y15 | | |
|
||||||
|
| WVAILD | B12_L9N_AF10 | | 3_B2_53 | AA15 | | |
|
||||||
|
| RST_N | B12_L8P_AE12 | | 3_B2_47 | Y14 | | |
|
||||||
|
| MOSI | B12_L8N_AF12 | | 3_B2_39 | AB12 | | |
|
||||||
|
| RREADY | B12_L7P_AE10 | | 3_B2_48 | AB15 | | |
|
||||||
|
| CLK | B12_L7N_AD10 | | 3_B2_35 | AA10 | | |
|
||||||
|
| MISO | B12_L6P_AA13 | | 3_B2_44 | AA14 | | |
|
||||||
|
| CS | B12_L6N_AA12 | | 3_B2_38 | AB11 | | |
|
||||||
|
| | B12_L5P_W13 | | 3_XO2_CLK2_0 | AA9 | | |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sheet: `Freq_CPLD`
|
||||||
|
|
||||||
|
- **Dimensions:** 57 rows x 8 columns
|
||||||
|
- **Merged cell ranges:** 0
|
||||||
|
|
||||||
|
| Level | Relay | CPLD | CPLD_Pin | Channel | Slot | | |
|
||||||
|
|---|---|---|---|---|---|---|---|---|---|
|
||||||
|
| #1 | RC_F1 | 2_B2_58 | U13 | 1-4&65-68||5-8&69-72 | 1 | | |
|
||||||
|
| | RC_F2 | 2_B2_46 | U12 | 129-132&193-196||133-136&197-200 | 1 | | |
|
||||||
|
| | RC_F3 | 2_B2_45 | T12 | 1-4&65-68||5-8&69-72 | 2 | | |
|
||||||
|
| | RC_F4 | 2_B2_34 | T11 | 129-132&193-196||133-136&197-200 | 2 | | |
|
||||||
|
| | RC_F5 | 2_B2_33 | U11 | 1-4&65-68||5-8&69-72 | 3 | | |
|
||||||
|
| | RC_F6 | 2_B2_29 | V11 | 129-132&193-196||133-136&197-200 | 3 | | |
|
||||||
|
| | RC_F7 | 2_B2_30 | W11 | 1-4&65-68||5-8&69-72 | 4 | | |
|
||||||
|
| | RC_F8 | 2_B2_27 | U10 | 129-132&193-196||133-136&197-200 | 4 | | |
|
||||||
|
| #2 | RC_S1 | 2_B2_28 | T10 | 1-2&5-6||3-4&7-8 | 1 | | |
|
||||||
|
| | RC_S2 | 2_B2_24 | W9 | 65-66&69-70||67-68&71-72 | 1 | | |
|
||||||
|
| | RC_S3 | 2_B2_11 | AB2 | 129-130&133-134||131-132&135-136 | 1 | | |
|
||||||
|
| | RC_S4 | 2_B2_01 | Y3 | 193-194&197-198||195-196&199-200 | 1 | | |
|
||||||
|
| | RC_S5 | 2_B2_02 | AA3 | 1-2&5-6||3-4&7-8 | 2 | | |
|
||||||
|
| | RC_S6 | 2_B2_12 | AB3 | 65-66&69-70||67-68&71-72 | 2 | | |
|
||||||
|
| | RC_S7 | 2_B2_06 | Y4 | 129-130&133-134||131-132&135-136 | 2 | | |
|
||||||
|
| | RC_S8 | 2_B2_13 | AA4 | 193-194&197-198||195-196&199-200 | 2 | | |
|
||||||
|
| | RC_S9 | 2_B2_14 | Y5 | 1-2&5-6||3-4&7-8 | 3 | | |
|
||||||
|
| | RC_S10 | 2_B2_15 | W6 | 65-66&69-70||67-68&71-72 | 3 | | |
|
||||||
|
| | RC_S11 | 2_B2_19 | AB5 | 129-130&133-134||131-132&135-136 | 3 | | |
|
||||||
|
| | RC_S12 | 2_B2_21 | AB6 | 193-194&197-198||195-196&199-200 | 3 | | |
|
||||||
|
| | RC_S13 | 2_B2_20 | Y6 | 1-2&5-6||3-4&7-8 | 4 | | |
|
||||||
|
| | RC_S14 | 2_B2_22 | Y7 | 65-66&69-70||67-68&71-72 | 4 | | |
|
||||||
|
| | RC_S15 | 2_B2_26 | AB7 | 129-130&133-134||131-132&135-136 | 4 | | |
|
||||||
|
| | RC_S16 | 2_B2_25 | AA7 | 193-194&197-198||195-196&199-200 | 4 | | |
|
||||||
|
| #3 | RC_T1 | 2_B2_32 | AA8 | 1&3||2&4 | 1 | | |
|
||||||
|
| | RC_T2 | 2_B2_84 | Y10 | 5&7||6&8 | 1 | | |
|
||||||
|
| | RC_T3 | 2_B2_36 | AB10 | 65&67||66&68 | 1 | | |
|
||||||
|
| | RC_T4 | 2_B2_35 | AA10 | 69&71||70&72 | 1 | | |
|
||||||
|
| | RC_T5 | 2_B2_37 | AA11 | 129&131||130&132 | 1 | | |
|
||||||
|
| | RC_T6 | 2_B2_38 | AB11 | 133&135||134&136 | 1 | | |
|
||||||
|
| | RC_T7 | 2_B2_40 | AA12 | 193&195||194&196 | 1 | | |
|
||||||
|
| | RC_T8 | 2_B2_41 | AB13 | 192&199||198&200 | 1 | | |
|
||||||
|
| | RC_T9 | 2_B2_17 | AA13 | 1&3||2&4 | 2 | | |
|
||||||
|
| | RC_T10 | 2_B2_50 | V12 | 5&7||6&8 | 2 | | |
|
||||||
|
| | RC_T11 | 2_B2_49 | W12 | 65&67||66&68 | 2 | | |
|
||||||
|
| | RC_T12 | 2_B2_51 | Y12 | 69&71||70&72 | 2 | | |
|
||||||
|
| | RC_T13 | 2_B2_52 | V13 | 129&131||130&132 | 2 | | |
|
||||||
|
| | RC_T14 | 2_B2_62 | V14 | 133&135||134&136 | 2 | | |
|
||||||
|
| | RC_T15 | 2_B2_73 | V16 | 193&195||194&196 | 2 | | |
|
||||||
|
| | RC_T16 | 2_B2_60 | AB17 | 192&199||198&200 | 2 | | |
|
||||||
|
| | RC_T17 | 2_B2_69 | Y18 | 1&3||2&4 | 3 | | 65&67||66&68 |
|
||||||
|
| | RC_T18 | 2_B2_70 | AA19 | 5&7||6&8 | 3 | | 69&71||70&72 |
|
||||||
|
| | RC_T19 | 2_B2_71 | AB20 | 65&67||66&68 | 3 | | 1&3||2&4 |
|
||||||
|
| | RC_T20 | 2_B2_80 | W19 | 69&71||70&72 | 3 | | 5&7||6&8 |
|
||||||
|
| | RC_T21 | 2_B2_68 | W17 | 129&131||130&132 | 3 | | 193&195||194&196 |
|
||||||
|
| | RC_T22 | 2_B2_63 | Y17 | 133&135||134&136 | 3 | | 192&199||198&200 |
|
||||||
|
| | RC_T23 | 2_B2_77 | T15 | 193&195||194&196 | 3 | | 129&131||130&132 |
|
||||||
|
| | RC_T24 | 2_B2_74 | U15 | 192&199||198&200 | 3 | | 133&135||134&136 |
|
||||||
|
| | RC_T25 | 2_B2_57 | T13 | 1&3||2&4 | 4 | | |
|
||||||
|
| | RC_T26 | 2_B2_42 | AA13 | 5&7||6&8 | 4 | | |
|
||||||
|
| | RC_T27 | 1_B2_58 | U13 | 65&67||66&68 | 4 | | |
|
||||||
|
| | RC_T28 | 1_B2_46 | U12 | 69&71||70&72 | 4 | | |
|
||||||
|
| | RC_T29 | 1_B2_45 | T12 | 129&131||130&132 | 4 | | |
|
||||||
|
| | RC_T30 | 1_B2_34 | T11 | 133&135||134&136 | 4 | | |
|
||||||
|
| | RC_T31 | 1_B2_33 | U11 | 193&195||194&196 | 4 | | |
|
||||||
|
| | RC_T32 | 1_B2_29 | V11 | 192&199||198&200 | 4 | | |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sheet: `Freq_Output`
|
||||||
|
|
||||||
|
- **Dimensions:** 20 rows x 18 columns
|
||||||
|
- **Merged cell ranges:** 19
|
||||||
|
|
||||||
|
| Slot | Relay_Out | Channel_Range | DUT_Port | DUT_EN | CPLD_Pin | | | DMM_EN | CPLD_Pin | | OUTPUT_Port | | Freq_BNC | CPLD_Pin | | | |
|
||||||
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||
|
| 1 | CAL_1.01 | 001-008 | D1_1 | OC_1.01 | 1_B1_35 | M19 | S_DMM_1 | OC_DMM0 | 1_B0_38 | F17 | DMM1 | 1_CAL | IO_RC1 | 1_B0_23 | F10 | | CTRL_SIG |
|
||||||
|
| | CAL_1.09 | 065-072 | D1_3 | OC_1.09 | 2_B0_59 | D14 | S_DMM_2 | OC_DMM1 | 1_B0_37 | E17 | | | | | | | CPLD1 |
|
||||||
|
| | CAL_1.17 | 129-136 | D1_5 | OC_1.17 | 1_B2_15 | W6 | S_DMM_3 | OC_DMM2 | 1_B0_52 | D17 | | | | | | | CPLD2 |
|
||||||
|
| | CAL_1.25 | 193-200 | D1_7 | OC_1.25 | 2_B3_04 | N5 | S_DMM_4 | OC_DMM3 | 1_B0_55 | C17 | | | | | | | CPLD3 |
|
||||||
|
| 2 | CAL_2.01 | 001-008 | D1_9 | OC_2.01 | 1_B0_45 | E16 | S_DMM_5 | OC_DMM4 | 1_B2_36 | AB10 | DMM2 | 2_CAL | IO_RC1 | 1_B0_23 | F10 | | |
|
||||||
|
| | CAL_2.09 | 065-072 | D1_11 | OC_2.09 | 2_B5_10 | C1 | S_DMM_6 | OC_DMM5 | 1_B2_37 | AA11 | | | PMU_RC1 | 3_B3_10 | V2 | | |
|
||||||
|
| | CAL_2.17 | 129-136 | D1_13 | OC_2.17 | 1_B0_58 | A17 | S_DMM_7 | OC_DMM6 | 1_B2_40 | AA12 | | | PMU_RC2 | 3_B1_38 | N18 | | |
|
||||||
|
| | CAL_2.25 | 193-200 | D1_15 | OC_2.25 | 2_B3_26 | T7 | S_DMM_8 | OC_DMM7 | 1_B2_41 | AB13 | | | | | | | |
|
||||||
|
| 3 | CAL_3.09 | 065-072 | D1_19 | OC_3.09 | 2_B0_34 | A11 | S_DMM_9 | OC_DMM8 | 1_B0_53 | D15 | DMM3 | 3_CAL | IO_RC1 | 1_B0_23 | F10 | | |
|
||||||
|
| | CAL_3.01 | 001-008 | D1_17 | OC_3.01 | 1_B3_03 | M3 | S_DMM_10 | OC_DMM9 | 1_B0_59 | D14 | | | PMU_RC1 | 3_B3_10 | V2 | | |
|
||||||
|
| | CAL_3.25 | 193-200 | D1_23 | OC_3.25 | 2_B0_76 | B13 | S_DMM_12 | OC_DMM12 | 1_B0_72 | F12 | | | PMU_RC3 | 3_B1_63 | P19 | | |
|
||||||
|
| | CAL_3.17 | 129-136 | D1_21 | OC_3.17 | 1_B0_17 | E8 | S_DMM_11 | OC_DMM11 | 1_B0_69 | C13 | | | | | | | |
|
||||||
|
| 4 | CAL_4.01 | 001-008 | D1_25 | OC_4.01 | 1_B0_75 | A13 | S_DMM_13 | OC_DMM12 | 1_B2_49 | W12 | DMM4 | 4_CAL | IO_RC1 | 1_B0_23 | F10 | | |
|
||||||
|
| | CAL_4.09 | 065-072 | D1_27 | OC_4.09 | 2_B5_22 | G1 | S_DMM_14 | OC_DMM13 | 1_B2_50 | V12 | | | PMU_RC1 | 3_B3_10 | V2 | | |
|
||||||
|
| | CAL_4.17 | 129-136 | D1_29 | OC_4.17 | 1_B0_68 | C15 | S_DMM_15 | OC_DMM14 | 1_B2_51 | Y12 | | | PMU_RC4 | 3_B1_64 | P18 | | |
|
||||||
|
| | CAL_4.25 | 193-200 | D1_31 | OC_4.25 | 2_B5_31 | E1 | S_DMM_16 | OC_DMM15 | 1_B2_52 | V13 | | | | | | | |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sheet: `PMU_CH_Sel`
|
||||||
|
|
||||||
|
- **Dimensions:** 133 rows x 26 columns
|
||||||
|
- **Merged cell ranges:** 98
|
||||||
|
|
||||||
|
| Slot | Relay_Out | Channel_Range | DUT_Port | DUT_EN | CPLD_Pin | | | DMM_EN | CPLD_Pin | | OUTPUT_Port | | DMM_SW | CPLD_Pin | | Resistor | Load_SW | CPLD_Pin | | VP/AP_SW | CPLD_Pin | | DMM_N | CPLD_Pin | |
|
||||||
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||
|
| 1 | CAL_1.01 | 001-008 | D1_1 | OC_1.01 | 1_B1_35 | M19 | S_DMM_1 | OC_DMM1 | 1_B0_38 | F17 | DMM1 | 1_CAL | PMU_RC1 | 3_B3_10 | V2 | 1Ω | RC_RL1 | 1_B4_14 | M6 | RC_VpK | 1_B4_08 | L7 | RC_LOF1 | 1_B5_32 | F3 |
|
||||||
|
| | CAL_1.02 | 009-016 | D2_1 | OC_1.02 | 1_B1_77 | R16 | | | | | | | | | | 5Ω | RC_RL2 | 1_B4_17 | M4 | RC_ApK | 1_B3_12 | P6 | RC_LOF2 | 1_B5_30 | H4 |
|
||||||
|
| | CAL_1.03 | 017-024 | D3_1 | OC_1.03 | 1_B1_31 | N20 | | | | | | | | | | 10Ω | RC_RL3 | 1_B0_35 | B10 | | | | RC_LOS1 | 1_B5_16 | G4 |
|
||||||
|
| | CAL_1.04 | 025-032 | D4_1 | OC_1.04 | 1_B1_69 | P20 | | | | | | | | | | 100Ω | RC_RL4 | 1_B4_15 | P3 | | | | RC_LOS2 | 1_B4_07 | L6 |
|
||||||
|
| | CAL_1.05 | 033-040 | D1_2 | OC_1.05 | 1_B1_10 | G19 | | | | | | | | | | 150Ω | RC_RL5 | 1_B5_04 | F5 | | | | | | |
|
||||||
|
| | CAL_1.06 | 041-048 | D2_2 | OC_1.06 | 1_B1_16 | J19 | | | | | | | | | | 499Ω | RC_RL6 | 1_B0_24 | G10 | | | | | | |
|
||||||
|
| | CAL_1.07 | 049-056 | D3_2 | OC_1.07 | 1_B1_04 | H16 | | | | | | | | | | 1kΩ | RC_RL7 | 1_B5_03 | F6 | | | | | | |
|
||||||
|
| | CAL_1.08 | 057-064 | D4_2 | OC_1.08 | 1_B1_13 | J17 | | | | | | | | | | 4.99kΩ | RC_RL8 | 1_B0_27 | C8 | | | | | | |
|
||||||
|
| | CAL_1.09 | 065-072 | D1_3 | OC_1.09 | 2_B0_59 | D14 | S_DMM_2 | OC_DMM2 | 1_B0_37 | E17 | | | | | | 10kΩ | RC_RL9 | 1_B0_21 | B7 | | | CPLD1 | CPLD2 | CPLD3 | |
|
||||||
|
| | CAL_1.10 | 073-080 | D2_3 | OC_1.10 | 2_B0_61 | G13 | | | | | | | | | | 49.9kΩ | RC_RL10 | 1_B0_09 | F8 | | | | | | |
|
||||||
|
| | CAL_1.11 | 081-088 | D3_3 | OC_1.11 | 2_B0_69 | C13 | | | | | | | | | | 100kΩ | RC_RL11 | 1_B0_14 | C5 | | | | | | |
|
||||||
|
| | CAL_1.12 | 089-096 | D4_3 | OC_1.12 | 2_B0_62 | F13 | | | | | | | | | | 402kΩ | RC_RL12 | 1_B0_08 | A3 | | | | | | |
|
||||||
|
| | CAL_1.13 | 097-104 | D1_4 | OC_1.13 | 2_B0_55 | C17 | | | | | | | | | | 1MΩ | RC_RL13 | 1_B0_33 | B11 | | | | | | |
|
||||||
|
| | CAL_1.14 | 105-112 | D2_4 | OC_1.14 | 2_B0_38 | F17 | | | | | | | | | | 1.5MΩ | RC_RL14 | 1_B0_15 | A5 | | | | | | |
|
||||||
|
| | CAL_1.15 | 113-120 | D3_4 | OC_1.15 | 2_B0_52 | D17 | | | | | | | | | | 2MΩ | RC_RL15 | 1_B0_13 | B4 | | | | | | |
|
||||||
|
| | CAL_1.16 | 121-128 | D4_4 | OC_1.16 | 2_B0_37 | E17 | | | | | | | | | | 4.99MΩ | RC_RL16 | 1_B0_31 | F11 | | | | | | |
|
||||||
|
| | CAL_1.17 | 129-136 | D1_5 | OC_1.17 | 1_B2_15 | W6 | S_DMM_3 | OC_DMM3 | 1_B0_52 | D17 | | | | | | 10MΩ | RC_RL17 | 1_B0_20 | D9 | | | | | | |
|
||||||
|
| | CAL_1.18 | 137-144 | D2_5 | OC_1.18 | 1_B2_25 | AA7 | | | | | | | | | | REV | RC_RL18 | 1_B3_04 | N5 | | | | | | |
|
||||||
|
| | CAL_1.19 | 145-152 | D3_5 | OC_1.19 | 1_B2_21 | AB6 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_1.20 | 153-160 | D4_5 | OC_1.20 | 1_B2_22 | Y7 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_1.21 | 161-168 | D1_6 | OC_1.21 | 1_B3_20 | V4 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_1.22 | 169-176 | D2_6 | OC_1.22 | 1_B3_18 | R6 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_1.23 | 177-184 | D3_6 | OC_1.23 | 1_B3_14 | U4 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_1.24 | 185-192 | D4_6 | OC_1.24 | 1_B3_17 | T5 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_1.25 | 193-200 | D1_7 | OC_1.25 | 2_B3_04 | N5 | S_DMM_4 | OC_DMM4 | 1_B0_55 | C17 | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_1.26 | 201-208 | D2_7 | OC_1.26 | 2_B0_53 | D15 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_1.27 | 209-216 | D3_7 | OC_1.27 | 2_B4_15 | P3 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_1.28 | 217-224 | D4_7 | OC_1.28 | 2_B4_17 | M4 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_1.29 | 225-232 | D1_8 | OC_1.29 | 2_B3_18 | R6 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_1.30 | 233-240 | D2_8 | OC_1.30 | 2_B3_17 | T5 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_1.31 | 241-248 | D3_8 | OC_1.31 | 2_B3_12 | P6 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_1.32 | 249-256 | D4_8 | OC_1.32 | 2_B3_14 | U4 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| 2 | CAL_2.01 | 001-008 | D1_9 | OC_2.01 | 1_B0_45 | E16 | S_DMM_5 | OC_DMM5 | 1_B2_36 | AB10 | DMM2 | 2_CAL | PMU_RC2 | 3_B1_38 | N18 | | | | | | | | | | |
|
||||||
|
| | CAL_2.02 | 009-016 | D2_9 | OC_2.02 | 1_B0_44 | F16 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.03 | 017-024 | D3_9 | OC_2.03 | 1_B0_51 | D16 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.04 | 025-032 | D4_9 | OC_2.04 | 1_B0_43 | G15 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.05 | 033-040 | D1_10 | OC_2.05 | 1_B1_06 | C22 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.06 | 041-048 | D2_10 | OC_2.06 | 1_B1_48 | D20 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.07 | 049-056 | D3_10 | OC_2.07 | 1_B1_49 | D21 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.08 | 057-064 | D4_10 | OC_2.08 | 1_B1_12 | D22 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.09 | 065-072 | D1_11 | OC_2.09 | 2_B5_10 | C1 | S_DMM_6 | OC_DMM6 | 1_B2_37 | AA11 | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.10 | 073-080 | D2_11 | OC_2.10 | 2_B5_02 | C2 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.11 | 081-088 | D3_11 | OC_2.11 | 2_B5_01 | C3 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.12 | 089-096 | D4_11 | OC_2.12 | 2_B5_09 | B1 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.13 | 097-104 | D1_12 | OC_2.13 | 2_B5_29 | H5 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.14 | 105-112 | D2_12 | OC_2.14 | 2_B5_11 | H6 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.15 | 113-120 | D3_12 | OC_2.15 | 2_B5_26 | H2 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.16 | 121-128 | D4_12 | OC_2.16 | 2_B5_25 | H3 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.17 | 129-136 | D1_13 | OC_2.17 | 1_B0_58 | A17 | S_DMM_7 | OC_DMM7 | 1_B2_40 | AA12 | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.18 | 137-144 | D2_13 | OC_2.18 | 1_B0_56 | A18 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.19 | 145-152 | D3_13 | OC_2.19 | 1_B0_49 | C18 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.20 | 153-160 | D4_13 | OC_2.20 | 1_B0_42 | D18 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.21 | 161-168 | D1_14 | OC_2.21 | 1_B0_61 | G13 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.22 | 169-176 | D2_14 | OC_2.22 | 1_B0_46 | F15 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.23 | 177-184 | D3_14 | OC_2.23 | 1_B0_62 | F13 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.24 | 185-192 | D4_14 | OC_2.24 | 1_B0_71 | G12 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.25 | 193-200 | D1_15 | OC_2.25 | 2_B3_26 | T7 | S_DMM_8 | OC_DMM8 | 1_B2_41 | AB13 | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.26 | 201-208 | D2_15 | OC_2.26 | 2_B3_25 | U5 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.27 | 209-216 | D3_15 | OC_2.27 | 2_B2_05 | W5 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.28 | 217-224 | D4_15 | OC_2.28 | 2_B3_22 | T6 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.29 | 225-232 | D1_16 | OC_2.29 | 2_B0_17 | E8 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.30 | 233-240 | D2_16 | OC_2.30 | 2_B0_19 | E9 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.31 | 241-248 | D3_16 | OC_2.31 | 2_B0_25 | E10 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_2.32 | 249-256 | D4_16 | OC_2.32 | 2_B0_30 | D11 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| 3 | CAL_3.01 | 001-008 | D1_17 | OC_3.01 | 1_B3_03 | M3 | S_DMM_10 | OC_DMM10 | 1_B0_59 | D14 | DMM3 | 3_CAL | PMU_RC3 | 3_B1_63 | P19 | | | | | | | | | | |
|
||||||
|
| | CAL_3.02 | 009-016 | D2_17 | OC_3.02 | 1_B4_16 | R1 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.03 | 017-024 | D3_17 | OC_3.03 | 1_B4_20 | N2 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.04 | 025-032 | D4_17 | OC_3.04 | 1_B4_19 | N1 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.05 | 033-040 | D1_18 | OC_3.05 | 1_B1_09 | F19 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.06 | 041-048 | D2_18 | OC_3.06 | 1_B1_47 | E19 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.07 | 049-056 | D3_18 | OC_3.07 | 1_B0_40 | C20 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.08 | 057-064 | D4_18 | OC_3.08 | 1_B0_39 | B20 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.09 | 065-072 | D1_19 | OC_3.09 | 2_B0_34 | A11 | S_DMM_9 | OC_DMM9 | 1_B0_53 | D15 | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.10 | 073-080 | D2_19 | OC_3.10 | 2_B0_73 | A12 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.11 | 081-088 | D3_19 | OC_3.11 | 2_B0_74 | B12 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.12 | 089-096 | D4_19 | OC_3.12 | 2_B0_75 | A13 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.13 | 097-104 | D1_20 | OC_3.13 | 2_B0_50 | B19 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.14 | 105-112 | D2_20 | OC_3.14 | 2_B0_49 | C18 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.15 | 113-120 | D3_20 | OC_3.15 | 2_B0_58 | A17 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.16 | 121-128 | D4_20 | OC_3.16 | 2_B0_64 | B16 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.17 | 129-136 | D1_21 | OC_3.17 | 1_B0_17 | E8 | S_DMM_11 | OC_DMM11 | 1_B0_69 | C13 | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.18 | 137-144 | D2_21 | OC_3.18 | 1_B0_19 | E9 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.19 | 145-152 | D3_21 | OC_3.19 | 1_B0_25 | E10 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.20 | 153-160 | D4_21 | OC_3.20 | 1_B0_30 | D11 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.21 | 161-168 | D1_22 | OC_3.21 | 1_B0_10 | E7 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.22 | 169-176 | D2_22 | OC_3.22 | 1_B0_12 | D7 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.23 | 177-184 | D3_22 | OC_3.23 | 1_B0_18 | D8 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.24 | 185-192 | D4_22 | OC_3.24 | 1_B0_28 | B8 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.25 | 193-200 | D1_23 | OC_3.25 | 2_B0_76 | B13 | S_DMM_12 | OC_DMM12 | 1_B0_72 | F12 | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.26 | 201-208 | D2_23 | OC_3.26 | 2_B0_70 | B14 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.27 | 209-216 | D3_23 | OC_3.27 | 2_B0_67 | B15 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.28 | 217-224 | D4_23 | OC_3.28 | 2_B0_68 | C15 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.29 | 225-232 | D1_24 | OC_3.29 | 2_B1_17 | G21 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.30 | 233-240 | D2_24 | OC_3.30 | 2_B1_51 | E22 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.31 | 241-248 | D3_24 | OC_3.31 | 2_B1_50 | E20 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_3.32 | 249-256 | D4_24 | OC_3.32 | 2_B1_49 | D21 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| 4 | CAL_4.01 | 001-008 | D1_25 | OC_4.01 | 1_B0_75 | A13 | S_DMM_13 | OC_DMM13 | 1_B2_49 | W12 | DMM4 | 4_CAL | PMU_RC4 | 3_B1_63 | P18 | | | | | | | | | | |
|
||||||
|
| | CAL_4.02 | 009-016 | D2_25 | OC_4.02 | 1_B0_76 | B13 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.03 | 017-024 | D3_25 | OC_4.03 | 1_B0_70 | B14 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.04 | 025-032 | D4_25 | OC_4.04 | 1_B0_67 | B15 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.05 | 033-040 | D1_26 | OC_4.05 | 1_B0_50 | B19 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.06 | 041-048 | D2_26 | OC_4.06 | 1_B0_65 | D12 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.07 | 049-056 | D3_26 | OC_4.07 | 1_B0_60 | E14 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.08 | 057-064 | D4_26 | OC_4.08 | 1_B0_54 | E15 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.09 | 065-072 | D1_27 | OC_4.09 | 2_B5_22 | G1 | S_DMM_14 | OC_DMM14 | 1_B2_50 | V12 | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.10 | 073-080 | D2_27 | OC_4.10 | 2_B5_21 | G2 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.11 | 081-088 | D3_27 | OC_4.11 | 2_B5_18 | G3 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.12 | 089-096 | D4_27 | OC_4.12 | 2_B5_17 | F1 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.13 | 097-104 | D1_27 | OC_4.13 | 2_B0_04 | C4 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.14 | 105-112 | D2_27 | OC_4.14 | 2_B0_14 | C5 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.15 | 113-120 | D3_27 | OC_4.15 | 2_B0_32 | G11 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.16 | 121-128 | D4_27 | OC_4.16 | 2_B0_29 | E11 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.17 | 129-136 | D1_29 | OC_4.17 | 1_B0_68 | C15 | S_DMM_15 | OC_DMM15 | 1_B2_51 | Y12 | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.18 | 137-144 | D2_29 | OC_4.18 | 1_B0_63 | A16 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.19 | 145-152 | D3_29 | OC_4.19 | 1_B0_64 | B16 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.20 | 153-160 | D4_29 | OC_4.20 | 1_B0_57 | C16 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.21 | 161-168 | D1_30 | OC_4.21 | 1_B0_66 | E12 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.22 | 169-176 | D1_30 | OC_4.22 | 1_B0_48 | A21 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.23 | 177-184 | D1_30 | OC_4.23 | 1_B1_05 | B22 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.24 | 185-192 | D1_30 | OC_4.24 | 1_B1_46 | C21 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.25 | 193-200 | D1_31 | OC_4.25 | 2_B5_31 | E1 | S_DMM_16 | OC_DMM16 | 1_B2_52 | V13 | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.26 | 201-208 | D1_29 | OC_4.26 | 2_B5_14 | D1 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.27 | 209-216 | D1_29 | OC_4.27 | 2_B5_13 | E2 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.28 | 217-224 | D1_29 | OC_4.28 | 2_B5_06 | D3 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.29 | 225-232 | D1_29 | OC_4.29 | 2_B0_26 | C11 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.30 | 233-240 | D1_29 | OC_4.30 | 2_B0_07 | A2 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.31 | 241-248 | D1_29 | OC_4.31 | 2_B0_01 | B3 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
| | CAL_4.32 | 249-256 | D1_29 | OC_4.32 | 2_B0_08 | A3 | | | | | | | | | | | | | | | | | | | |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
[Runmanager]
|
[Runmanager]
|
||||||
Geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\0\0\0\x3\x30\0\0\x1!\0\0\x4\x11\0\0\0\0\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\0\0\0\0\0\0)
|
Geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\0\0\0\x3\x30\0\0\x1!\0\0\x4\r\0\0\0\0\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\0\0\0\0\0\0)
|
||||||
windowState=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\x1\0\0\0\0\0\0\0\x1\xff\xff\xff\xff\x3\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0)
|
windowState=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\x1\0\0\0\0\0\0\0\x1\xff\xff\xff\xff\x3\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0)
|
||||||
headerState=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\x1\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x16\0\xe0?\0\0\0\t\0\0\0\x10\0\0\0\x64\0\0\0\xf\0\0\0\x64\0\0\0\xe\0\0\0\x64\0\0\0\r\0\0\0\x64\0\0\0\x15\0\0\0\x64\0\0\0\x14\0\0\0\x64\0\0\0\x13\0\0\0\x64\0\0\0\x12\0\0\0\x64\0\0\0\x11\0\0\0\x64\0\0\x4\xd3\0\0\0\x16\x1\x1\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x3\0\0\0#\0\0\0\x1\0\0\0\x2\0\0\x4\xb0\0\0\0\f\0\0\0\0\0\0\0\0\0\0\0\t\0\0\0\0)
|
headerState=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\x1\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x16\0\xe0?\0\0\0\t\0\0\0\x10\0\0\0\x64\0\0\0\xf\0\0\0\x64\0\0\0\xe\0\0\0\x64\0\0\0\r\0\0\0\x64\0\0\0\x15\0\0\0\x64\0\0\0\x14\0\0\0\x64\0\0\0\x13\0\0\0\x64\0\0\0\x12\0\0\0\x64\0\0\0\x11\0\0\0\x64\0\0\x4\xd3\0\0\0\x16\x1\x1\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x3\0\0\0#\0\0\0\x1\0\0\0\x2\0\0\x4\xb0\0\0\0\f\0\0\0\0\0\0\0\0\0\0\0\t\0\0\0\0)
|
||||||
|
|
||||||
|
|||||||
@@ -6,40 +6,40 @@ sig_sort_ascending=true
|
|||||||
active_Sheet=Port Assignments
|
active_Sheet=Port Assignments
|
||||||
|
|
||||||
[Port%20Assignments]
|
[Port%20Assignments]
|
||||||
Name="202,0"
|
Name="207,0"
|
||||||
Group%20By="111,1"
|
Group%20By="118,1"
|
||||||
Pin="62,2"
|
Pin="71,2"
|
||||||
BANK="85,3"
|
BANK="91,3"
|
||||||
BANK_VCC="125,4"
|
BANK_VCC="129,4"
|
||||||
VREF="81,5"
|
VREF="85,5"
|
||||||
IO_TYPE="216,6"
|
IO_TYPE="111,6"
|
||||||
PULLMODE="127,7"
|
PULLMODE="133,7"
|
||||||
DRIVE="86,8"
|
DRIVE="92,8"
|
||||||
SLEWRATE="126,9"
|
SLEWRATE="129,9"
|
||||||
CLAMP="95,10"
|
CLAMP="99,10"
|
||||||
OPENDRAIN="133,11"
|
OPENDRAIN="139,11"
|
||||||
DIFFRESISTOR="155,12"
|
DIFFRESISTOR="160,12"
|
||||||
DIFFDRIVE="122,13"
|
DIFFDRIVE="127,13"
|
||||||
HYSTERESIS="140,14"
|
HYSTERESIS="143,14"
|
||||||
Outload%20%28pF%29="133,15"
|
Outload%20%28pF%29="144,15"
|
||||||
MaxSkew="111,16"
|
MaxSkew="120,16"
|
||||||
Clock%20Load%20Only="165,17"
|
Clock%20Load%20Only="172,17"
|
||||||
SwitchingID="129,18"
|
SwitchingID="141,18"
|
||||||
Ground%20plane%20PCB%20noise%20%28mV%29="267,19"
|
Ground%20plane%20PCB%20noise%20%28mV%29="274,19"
|
||||||
Power%20plane%20PCB%20noise%20%28mV%29="257,20"
|
Power%20plane%20PCB%20noise%20%28mV%29="266,20"
|
||||||
SSO%20Allowance%28%25%29="181,21"
|
SSO%20Allowance%28%25%29="189,21"
|
||||||
sort_columns="Name,Ascending"
|
sort_columns="Name,Ascending"
|
||||||
|
|
||||||
[Pin%20Assignments]
|
[Pin%20Assignments]
|
||||||
Pin="102,0"
|
Pin="111,0"
|
||||||
Pad%20Name="116,1"
|
Pad%20Name="126,1"
|
||||||
Dual%20Function="144,2"
|
Dual%20Function="157,2"
|
||||||
Polarity="97,3"
|
Polarity="108,3"
|
||||||
BANK="0,4"
|
BANK="0,4"
|
||||||
BANK_VCC="125,5"
|
BANK_VCC="129,5"
|
||||||
IO_TYPE="105,6"
|
IO_TYPE="111,6"
|
||||||
Signal%20Name="134,7"
|
Signal%20Name="144,7"
|
||||||
Signal%20Type="127,8"
|
Signal%20Type="137,8"
|
||||||
sort_columns="Pin,Ascending"
|
sort_columns="Pin,Ascending"
|
||||||
|
|
||||||
[Clock%20Resource]
|
[Clock%20Resource]
|
||||||
@@ -48,8 +48,8 @@ Clock%20Name="215,ELLIPSIS"
|
|||||||
Selection="100,ELLIPSIS"
|
Selection="100,ELLIPSIS"
|
||||||
|
|
||||||
[Global%20Preferences]
|
[Global%20Preferences]
|
||||||
Preference%20Name="234,ELLIPSIS"
|
Preference%20Name="230,ELLIPSIS"
|
||||||
Preference%20Value="227,ELLIPSIS"
|
Preference%20Value="232,ELLIPSIS"
|
||||||
|
|
||||||
[Cell%20Mapping]
|
[Cell%20Mapping]
|
||||||
Type="100,ELLIPSIS"
|
Type="100,ELLIPSIS"
|
||||||
@@ -63,14 +63,14 @@ Name="100,ELLIPSIS"
|
|||||||
Prioritize="100,ELLIPSIS"
|
Prioritize="100,ELLIPSIS"
|
||||||
|
|
||||||
[Timing%20Preferences]
|
[Timing%20Preferences]
|
||||||
Preference%20Name="140,ELLIPSIS"
|
Preference%20Name="146,ELLIPSIS"
|
||||||
Preference%20Value="138,ELLIPSIS"
|
Preference%20Value="143,ELLIPSIS"
|
||||||
Preference%20Unit="128,ELLIPSIS"
|
Preference%20Unit="133,ELLIPSIS"
|
||||||
|
|
||||||
[Group]
|
[Group]
|
||||||
Group%20Type\Name="147,ELLIPSIS"
|
Group%20Type\Name="153,ELLIPSIS"
|
||||||
Value="51,ELLIPSIS"
|
Value="53,ELLIPSIS"
|
||||||
|
|
||||||
[Misc%20Preferences]
|
[Misc%20Preferences]
|
||||||
Preference%20Name="140,ELLIPSIS"
|
Preference%20Name="146,ELLIPSIS"
|
||||||
Preference%20Value="138,ELLIPSIS"
|
Preference%20Value="143,ELLIPSIS"
|
||||||
|
|||||||
@@ -152,8 +152,6 @@ module BUS_Con (
|
|||||||
|
|
||||||
// --- 4. Register Control FSM ---
|
// --- 4. Register Control FSM ---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
always @(posedge i_sys_clk) begin
|
always @(posedge i_sys_clk) begin
|
||||||
if (!i_rst_n) begin
|
if (!i_rst_n) begin
|
||||||
state <= IDLE;
|
state <= IDLE;
|
||||||
@@ -210,6 +208,6 @@ module BUS_Con (
|
|||||||
assign o_wready = (state == IDLE);
|
assign o_wready = (state == IDLE);
|
||||||
|
|
||||||
// Pass through unused signal or hook it up if needed
|
// Pass through unused signal or hook it up if needed
|
||||||
assign o_rvalid = 1'b0;
|
assign o_rvalid = i_rvalid;
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
+287
-101
@@ -2,16 +2,40 @@ module CPLD_Con (
|
|||||||
input i_sys_clk,
|
input i_sys_clk,
|
||||||
input i_rst_n,
|
input i_rst_n,
|
||||||
input i_con_exec,
|
input i_con_exec,
|
||||||
|
|
||||||
|
// Freq Relay Control
|
||||||
input [23:0]i_freq_relay1,
|
input [23:0]i_freq_relay1,
|
||||||
input [23:0]i_freq_relay2,
|
input [23:0]i_freq_relay2,
|
||||||
input [23:0]i_freq_relay3,
|
input [23:0]i_freq_relay3,
|
||||||
input [23:0]i_freq_relay4,
|
input [23:0]i_freq_relay4,
|
||||||
output o_con_done,
|
|
||||||
|
// DC related Control
|
||||||
|
input [23:0]i_DC_Con1,
|
||||||
|
input [23:0]i_DC_Con2,
|
||||||
|
input [23:0]i_DC_Con3,
|
||||||
|
input [23:0]i_DC_Con4,
|
||||||
|
|
||||||
|
//Output RELAYs
|
||||||
output [3:0]o_OC_x01,
|
output [3:0]o_OC_x01,
|
||||||
output [3:0]o_OC_x17,
|
output [3:0]o_OC_x17,
|
||||||
output [18:0]o_DMM_EN,
|
output [18:0]o_DMM_EN,
|
||||||
output o_IO_RC1,
|
output o_IO_RC1,
|
||||||
output [4:0]o_RC_Tx,
|
output [5:0]o_RC_Tx,
|
||||||
|
|
||||||
|
output [31:0]o_PMU_OC_1 ,
|
||||||
|
output [31:0]o_PMU_OC_2 ,
|
||||||
|
output [31:0]o_PMU_OC_3 ,
|
||||||
|
output [31:0]o_PMU_OC_4 ,
|
||||||
|
|
||||||
|
// DMM Mode Sel
|
||||||
|
output o_RC_VSel,
|
||||||
|
output o_RC_ISel,
|
||||||
|
|
||||||
|
// Output RLoad Sel
|
||||||
|
output [17:0]o_RC_RLSel,
|
||||||
|
|
||||||
|
// FLAGs
|
||||||
|
output o_con_done,
|
||||||
output o_err
|
output o_err
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -20,13 +44,26 @@ module CPLD_Con (
|
|||||||
reg [3:0]OC_x17 ;
|
reg [3:0]OC_x17 ;
|
||||||
reg [18:0]DMM_en ;
|
reg [18:0]DMM_en ;
|
||||||
|
|
||||||
reg[4:0]RC_Tx;
|
reg[5:0]RC_Tx;
|
||||||
reg io_RC;
|
reg io_RC;
|
||||||
|
|
||||||
|
reg RC_VISel;
|
||||||
|
reg [17:0]RC_RLSel ;
|
||||||
|
reg [31:0]PMU_OC_1 ;
|
||||||
|
reg [31:0]PMU_OC_2 ;
|
||||||
|
reg [31:0]PMU_OC_3 ;
|
||||||
|
reg [31:0]PMU_OC_4 ;
|
||||||
|
|
||||||
|
//Condition Tester
|
||||||
|
reg [15:0]en_t ;
|
||||||
|
reg freq_t;
|
||||||
|
reg dc_t;
|
||||||
|
|
||||||
//Flags
|
//Flags
|
||||||
reg exec_flag;
|
reg exec_flag;
|
||||||
reg err_flag;
|
reg err_flag;
|
||||||
reg [3:0]slot_exec_flag;
|
reg [3:0]freq_slot_flag;
|
||||||
|
reg [3:0]dc_slot_flag ;
|
||||||
reg done_flag;
|
reg done_flag;
|
||||||
|
|
||||||
//Counter
|
//Counter
|
||||||
@@ -46,130 +83,269 @@ module CPLD_Con (
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
//Function Identify
|
||||||
|
always @(posedge i_sys_clk) begin
|
||||||
|
if (i_rst_n == 1'b0) begin
|
||||||
|
en_t <= 'd0;
|
||||||
|
freq_t <= 'd0;
|
||||||
|
dc_t <= 'd0;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
en_t <= (i_freq_relay1[0] + i_freq_relay2[0] + i_freq_relay3[0] + i_freq_relay4[0]) + (i_DC_Con1[0] +i_DC_Con2[0] +i_DC_Con3[0] +i_DC_Con4[0] );
|
||||||
|
freq_t <= i_freq_relay1[0] + i_freq_relay2[0] + i_freq_relay3[0] + i_freq_relay4[0];
|
||||||
|
dc_t <= i_DC_Con1[0] +i_DC_Con2[0] +i_DC_Con3[0] +i_DC_Con4[0];
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
// Main Controller Function
|
||||||
always @(posedge i_sys_clk) begin
|
always @(posedge i_sys_clk) begin
|
||||||
if (i_rst_n == 1'b0) begin
|
if (i_rst_n == 1'b0) begin
|
||||||
exec_flag <= 1'b0;
|
exec_flag <= 1'b0;
|
||||||
err_flag <= 1'b0;
|
err_flag <= 1'b0;
|
||||||
slot_exec_flag <= 'd0;
|
|
||||||
|
|
||||||
OC_x01 <= 'd0;
|
freq_slot_flag <= 'd0;
|
||||||
OC_x17 <= 'd0;
|
dc_slot_flag <= 'd0;
|
||||||
io_RC <= 'd0;
|
|
||||||
|
OC_x01 <= 'd0;
|
||||||
|
OC_x17 <= 'd0;
|
||||||
|
|
||||||
|
DMM_en <= 'd0;
|
||||||
|
|
||||||
|
RC_VISel <='d0;
|
||||||
|
RC_RLSel <='d0;
|
||||||
|
|
||||||
|
PMU_OC_1 <= 'd0 ;
|
||||||
|
PMU_OC_2 <= 'd0 ;
|
||||||
|
PMU_OC_3 <= 'd0 ;
|
||||||
|
PMU_OC_4 <= 'd0 ;
|
||||||
|
|
||||||
done_flag <= 'd1;
|
done_flag <= 'd1;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
if ((i_con_exec == 1'b1) & (exec_flag == 1'b0)) begin
|
if ((i_con_exec == 1'b1) & (exec_flag == 1'b0)) begin
|
||||||
exec_flag <= 1'b1;
|
|
||||||
done_flag <= 1'b0;
|
|
||||||
//To DO: More Sanity Check?
|
//To DO: More Sanity Check?
|
||||||
if (i_freq_relay1[0] && i_freq_relay2[0] && i_freq_relay3[0] && i_freq_relay4[0]) begin
|
if (en_t > 'd1) begin //Only ONE Enable bit should be set!
|
||||||
err_flag <= 1'b1;
|
err_flag <= 1'b1;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
slot_exec_flag[0] <= i_freq_relay1[0];
|
exec_flag <= 1'b1;
|
||||||
slot_exec_flag[1] <= i_freq_relay2[0];
|
done_flag <= 1'b0;
|
||||||
slot_exec_flag[2] <= i_freq_relay3[0];
|
err_flag <= 1'b0;
|
||||||
slot_exec_flag[3] <= i_freq_relay4[0];
|
freq_slot_flag[0] <= i_freq_relay1[0];
|
||||||
RC_Tx <= i_freq_relay4[14:10];
|
freq_slot_flag[1] <= i_freq_relay2[0];
|
||||||
|
freq_slot_flag[2] <= i_freq_relay3[0];
|
||||||
|
freq_slot_flag[3] <= i_freq_relay4[0];
|
||||||
|
|
||||||
|
RC_Tx <= i_freq_relay4[17:12]; //Special Relay for slot4
|
||||||
|
|
||||||
|
dc_slot_flag[0] <= i_DC_Con1[0];
|
||||||
|
dc_slot_flag[1] <= i_DC_Con2[0];
|
||||||
|
dc_slot_flag[2] <= i_DC_Con3[0];
|
||||||
|
dc_slot_flag[3] <= i_DC_Con4[0];
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else if (exec_flag == 1'b1) begin
|
else if (exec_flag == 1'b1) begin
|
||||||
io_RC <= i_freq_relay1[0] || i_freq_relay2[0] || i_freq_relay3[0] || i_freq_relay4[0];
|
if (freq_t == 1'b1) begin
|
||||||
case (slot_exec_flag)
|
io_RC <= i_freq_relay1[0] || i_freq_relay2[0] || i_freq_relay3[0] || i_freq_relay4[0];
|
||||||
4'b0001: begin
|
case (freq_slot_flag)
|
||||||
if (i_freq_relay1[9:1] < 9) begin
|
4'b0001: begin
|
||||||
OC_x01 <= 4'b0001;
|
if (i_freq_relay1[9:1] < 9) begin
|
||||||
OC_x17 <= 'd0;
|
OC_x01 <= 4'b0001;
|
||||||
DMM_en <= 19'b000_0000_0000_0000_0001;
|
OC_x17 <= 'd0;
|
||||||
|
DMM_en <= 19'b000_0000_0000_0000_0001;
|
||||||
|
end
|
||||||
|
else if (i_freq_relay1[9:1] < 73) begin
|
||||||
|
DMM_en <= 19'b000_0000_0000_0000_0010;
|
||||||
|
OC_x01 <= 'd0;
|
||||||
|
OC_x17 <= 'd0;
|
||||||
|
end
|
||||||
|
else if (i_freq_relay1[9:1] < 137) begin
|
||||||
|
OC_x17 <= 4'b0001;
|
||||||
|
OC_x01 <= 'd0;
|
||||||
|
DMM_en <= 19'b000_0000_0000_0000_0100;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
DMM_en <= 19'b000_0000_0000_0000_1000;
|
||||||
|
OC_x01 <= 'd0;
|
||||||
|
OC_x17 <= 'd0;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else if (i_freq_relay1[9:1] < 73) begin
|
4'b0010: begin
|
||||||
DMM_en <= 19'b000_0000_0000_0000_0010;
|
if (i_freq_relay2[9:1] < 9) begin
|
||||||
OC_x01 <= 'd0;
|
OC_x01 <= 4'b0010;
|
||||||
OC_x17 <= 'd0;
|
OC_x17 <= 'd0;
|
||||||
|
DMM_en <= 19'b000_0000_0000_0001_0000;
|
||||||
|
end
|
||||||
|
else if (i_freq_relay2[9:1] < 73) begin
|
||||||
|
DMM_en <= 19'b000_0000_0000_0010_0000;
|
||||||
|
OC_x01 <= 'd0;
|
||||||
|
OC_x17 <= 'd0;
|
||||||
|
end
|
||||||
|
else if (i_freq_relay2[9:1] < 137) begin
|
||||||
|
OC_x17 <= 4'b0010;
|
||||||
|
OC_x01 <= 'd0;
|
||||||
|
DMM_en <= 19'b000_0000_0000_0100_0000;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
OC_x01 <= 'd0;
|
||||||
|
OC_x17 <= 'd0;
|
||||||
|
DMM_en <= 19'b000_0000_0000_1000_0000;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else if (i_freq_relay1[9:1] < 137) begin
|
4'b0100: begin
|
||||||
OC_x17 <= 4'b0001;
|
if (i_freq_relay3[9:1] < 9) begin
|
||||||
OC_x01 <= 'd0;
|
OC_x01 <= 'b0100;
|
||||||
DMM_en <= 19'b000_0000_0000_0000_0100;
|
OC_x17 <= 'd0;
|
||||||
|
DMM_en <= 19'b000_0000_0001_0000_0000;
|
||||||
|
end
|
||||||
|
else if ((i_freq_relay3[9:1] > 64)& (i_freq_relay3[9:1] < 73)) begin
|
||||||
|
OC_x01 <= 4'b0000;
|
||||||
|
OC_x17 <= 'd0;
|
||||||
|
DMM_en <= 19'b000_0000_0010_0000_0000;
|
||||||
|
end
|
||||||
|
else if (i_freq_relay3[9:1] < 137) begin
|
||||||
|
DMM_en <= 19'b000_0000_0100_0000_0000;
|
||||||
|
OC_x01 <= 'd0;
|
||||||
|
OC_x17 <= 'b0100;
|
||||||
|
end
|
||||||
|
else if (i_freq_relay3[9:1] < 201) begin
|
||||||
|
OC_x17 <= 4'd0;
|
||||||
|
OC_x01 <= 'd0;
|
||||||
|
DMM_en <= 16'b000_0000_1000_0000_0000;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else begin
|
4'b1000: begin
|
||||||
DMM_en <= 19'b000_0000_0000_0000_1000;
|
if (i_freq_relay4[9:1] < 9) begin
|
||||||
OC_x01 <= 'd0;
|
OC_x01 <= 4'b1000;
|
||||||
OC_x17 <= 'd0;
|
OC_x17 <= 'd0;
|
||||||
|
DMM_en <= 19'b000_0001_0000_0000_0000;
|
||||||
|
end
|
||||||
|
else if (i_freq_relay4[9:1] < 72) begin
|
||||||
|
DMM_en <= 19'b000_0010_0000_0000_0000;
|
||||||
|
OC_x01 <= 'd0;
|
||||||
|
OC_x17 <= 'd0;
|
||||||
|
end
|
||||||
|
else if (i_freq_relay4[9:1] < 137) begin
|
||||||
|
OC_x17 <= 4'b1000;
|
||||||
|
OC_x01 <= 'd0;
|
||||||
|
DMM_en <= 19'b000_0100_0000_0000_0000;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
OC_x01 <= 'd0;
|
||||||
|
OC_x17 <= 'd0;
|
||||||
|
DMM_en <= 19'b000_1000_0000_0000_0000;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
default: begin // You Should NOT be HERE
|
||||||
4'b0010: begin
|
|
||||||
if (i_freq_relay2[9:1] < 9) begin
|
|
||||||
OC_x01 <= 4'b0010;
|
|
||||||
OC_x17 <= 'd0;
|
|
||||||
DMM_en <= 19'b000_0000_0000_0001_0000;
|
|
||||||
end
|
|
||||||
else if (i_freq_relay2[9:1] < 73) begin
|
|
||||||
DMM_en <= 19'b000_0000_0000_0010_0000;
|
|
||||||
OC_x01 <= 'd0;
|
|
||||||
OC_x17 <= 'd0;
|
|
||||||
end
|
|
||||||
else if (i_freq_relay2[9:1] < 137) begin
|
|
||||||
OC_x17 <= 4'b0010;
|
|
||||||
OC_x01 <= 'd0;
|
|
||||||
DMM_en <= 19'b000_0000_0000_0100_0000;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
OC_x01 <= 'd0;
|
|
||||||
OC_x17 <= 'd0;
|
|
||||||
DMM_en <= 19'b000_0000_0000_1000_0000;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
4'b0100: begin
|
|
||||||
if (i_freq_relay3[9:1] < 9) begin
|
|
||||||
OC_x01 <= 'b0100;
|
|
||||||
OC_x17 <= 'd0;
|
|
||||||
DMM_en <= 19'b000_0000_0001_0000_0000;
|
|
||||||
end
|
|
||||||
else if ((i_freq_relay3[9:1] > 64)& (i_freq_relay3[9:1] < 73)) begin
|
|
||||||
OC_x01 <= 4'b0000;
|
OC_x01 <= 4'b0000;
|
||||||
OC_x17 <= 'd0;
|
OC_x17 <= 4'b0000;
|
||||||
DMM_en <= 19'b000_0000_0010_0000_0000;
|
DMM_en <= 'd0;
|
||||||
end
|
end
|
||||||
else if (i_freq_relay3[9:1] < 137) begin
|
endcase
|
||||||
DMM_en <= 19'b000_0000_0100_0000_0000;
|
end
|
||||||
OC_x01 <= 'd0;
|
else if (dc_t == 1'b1) begin
|
||||||
OC_x17 <= 'b0100;
|
case (dc_slot_flag)
|
||||||
|
4'b0001: begin
|
||||||
|
if (i_DC_Con1[22] == 1'b1) begin
|
||||||
|
RC_VISel <= 1'b1; //Select Current
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
RC_VISel <= 1'b0; //Select Voltage
|
||||||
|
end
|
||||||
|
//Sanity Check
|
||||||
|
if ((i_DC_Con1[21:17] < 1) || (i_DC_Con1[21:17] > 18) || (i_DC_Con1[9:1] < 1) || (i_DC_Con1[9:1] > 256)) begin
|
||||||
|
err_flag <= 1'b1;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
RC_RLSel <= (18'b00_0000_0000_0000_0001)<<(i_DC_Con1[21:17] - 1);
|
||||||
|
if (i_DC_Con1[23] == 1'b0) begin //Select PMU
|
||||||
|
PMU_OC_1 <= (32'b0000_0000_0000_0000_0000_0000_0000_0001)<<(i_DC_Con1[9:1]/8);
|
||||||
|
DMM_en <= (19'b000_0000_0000_0000_0001)<<(i_DC_Con1[9:1]/8);
|
||||||
|
end
|
||||||
|
else if (i_DC_Con1[23] == 1'b1) begin //Select DPS
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else if (i_freq_relay3[9:1] < 201) begin
|
4'b0010: begin
|
||||||
OC_x17 <= 4'd0;
|
if (i_DC_Con2[22] == 1'b1) begin
|
||||||
OC_x01 <= 'd0;
|
RC_VISel <= 1'b1; //Select Current
|
||||||
DMM_en <= 16'b000_0000_1000_0000_0000;
|
end
|
||||||
|
else begin
|
||||||
|
RC_VISel <= 1'b0; //Select Voltage
|
||||||
|
end
|
||||||
|
//Sanity Check
|
||||||
|
if ((i_DC_Con2[21:17] < 1) || (i_DC_Con2[21:17] > 18) || (i_DC_Con2[9:1] < 1) || (i_DC_Con2[9:1] > 256)) begin
|
||||||
|
err_flag <= 1'b1;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
RC_RLSel <= (18'b00_0000_0000_0000_0001)<<(i_DC_Con2[21:17] - 1);
|
||||||
|
if (i_DC_Con2[23] == 1'b0) begin //Select PMU
|
||||||
|
PMU_OC_2 <= (32'b0000_0000_0000_0000_0000_0000_0000_0001)<<(i_DC_Con2[9:1]/8);
|
||||||
|
DMM_en <= (19'b000_0000_0000_0000_0001)<<(i_DC_Con2[9:1]/8);
|
||||||
|
end
|
||||||
|
else if (i_DC_Con2[23] == 1'b1) begin //Select DPS
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
4'b0100:begin
|
||||||
4'b1000: begin
|
if (i_DC_Con3[22] == 1'b1) begin
|
||||||
if (i_freq_relay4[9:1] < 9) begin
|
RC_VISel <= 1'b1; //Select Current
|
||||||
OC_x01 <= 4'b1000;
|
end
|
||||||
OC_x17 <= 'd0;
|
else begin
|
||||||
DMM_en <= 19'b000_0001_0000_0000_0000;
|
RC_VISel <= 1'b0; //Select Voltage
|
||||||
|
end
|
||||||
|
//Sanity Check
|
||||||
|
if ((i_DC_Con3[21:17] < 1) || (i_DC_Con3[21:17] > 18) || (i_DC_Con3[9:1] < 1) || (i_DC_Con3[9:1] > 256)) begin
|
||||||
|
err_flag <= 1'b1;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
RC_RLSel <= (18'b00_0000_0000_0000_0001)<<(i_DC_Con3[21:17] - 1);
|
||||||
|
if (i_DC_Con3[23] == 1'b0) begin //Select PMU
|
||||||
|
PMU_OC_3 <= (32'b0000_0000_0000_0000_0000_0000_0000_0001)<<(i_DC_Con3[9:1]/8);
|
||||||
|
DMM_en <= (19'b000_0000_0000_0000_0001)<<(i_DC_Con3[9:1]/8);
|
||||||
|
end
|
||||||
|
else if (i_DC_Con3[23] == 1'b1) begin //Select DPS
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else if (i_freq_relay4[9:1] < 72) begin
|
4'b1000:begin
|
||||||
DMM_en <= 19'b000_0010_0000_0000_0000;
|
if (i_DC_Con4[22] == 1'b1) begin
|
||||||
OC_x01 <= 'd0;
|
RC_VISel <= 1'b1; //Select Current
|
||||||
OC_x17 <= 'd0;
|
end
|
||||||
|
else begin
|
||||||
|
RC_VISel <= 1'b0; //Select Voltage
|
||||||
|
end
|
||||||
|
//Sanity Check
|
||||||
|
if ((i_DC_Con4[21:17] < 1) || (i_DC_Con4[21:17] > 18) || (i_DC_Con4[9:1] < 1) || (i_DC_Con4[9:1] > 256)) begin
|
||||||
|
err_flag <= 1'b1;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
RC_RLSel <= (18'b00_0000_0000_0000_0001)<<(i_DC_Con4[21:17] - 1);
|
||||||
|
if (i_DC_Con4[23] == 1'b0) begin //Select PMU
|
||||||
|
PMU_OC_4 <= (32'b0000_0000_0000_0000_0000_0000_0000_0001)<<(i_DC_Con4[9:1]/8);
|
||||||
|
DMM_en <= (19'b000_0000_0000_0000_0001)<<(i_DC_Con4[9:1]/8);
|
||||||
|
end
|
||||||
|
else if (i_DC_Con4[23] == 1'b1) begin //Select DPS
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else if (i_freq_relay4[9:1] < 137) begin
|
default:begin // You Should NOT be HERE
|
||||||
OC_x17 <= 4'b1000;
|
RC_VISel <='d0;
|
||||||
OC_x01 <= 'd0;
|
RC_RLSel <='d0;
|
||||||
DMM_en <= 19'b000_0100_0000_0000_0000;
|
|
||||||
|
PMU_OC_1 <= 'd0 ;
|
||||||
|
PMU_OC_2 <= 'd0 ;
|
||||||
|
PMU_OC_3 <= 'd0 ;
|
||||||
|
PMU_OC_4 <= 'd0 ;
|
||||||
|
DMM_en <= 'd0;
|
||||||
end
|
end
|
||||||
else begin
|
endcase
|
||||||
OC_x01 <= 'd0;
|
end
|
||||||
OC_x17 <= 'd0;
|
|
||||||
DMM_en <= 19'b000_1000_0000_0000_0000;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
default: begin
|
|
||||||
OC_x01 <= 4'b0000;
|
|
||||||
OC_x17 <= 4'b0000;
|
|
||||||
DMM_en <= 'd0;
|
|
||||||
end
|
|
||||||
endcase
|
|
||||||
done_flag <= 1'b1;
|
done_flag <= 1'b1;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -186,5 +362,15 @@ module CPLD_Con (
|
|||||||
assign o_err = err_flag;
|
assign o_err = err_flag;
|
||||||
assign o_RC_Tx = RC_Tx;
|
assign o_RC_Tx = RC_Tx;
|
||||||
|
|
||||||
|
assign o_RC_ISel = (RC_VISel==1'b1)?1:0;
|
||||||
|
assign o_RC_VSel = (RC_VISel==1'b1)?0:1;
|
||||||
|
|
||||||
|
assign o_RC_RLSel = RC_RLSel;
|
||||||
|
|
||||||
|
assign o_PMU_OC_1 = PMU_OC_1;
|
||||||
|
assign o_PMU_OC_2 = PMU_OC_2;
|
||||||
|
assign o_PMU_OC_3 = PMU_OC_3;
|
||||||
|
assign o_PMU_OC_4 = PMU_OC_4;
|
||||||
|
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
+258
-192
@@ -18,7 +18,6 @@ IOBUF PORT "i_mosi" IO_TYPE=LVCMOS33 ;
|
|||||||
IOBUF PORT "i_rst_n" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "i_rst_n" IO_TYPE=LVCMOS33 ;
|
||||||
IOBUF PORT "i_sclk" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "i_sclk" IO_TYPE=LVCMOS33 ;
|
||||||
IOBUF PORT "o_miso" IO_TYPE=LVCMOS33 PULLMODE=NONE DRIVE=8 ;
|
IOBUF PORT "o_miso" IO_TYPE=LVCMOS33 PULLMODE=NONE DRIVE=8 ;
|
||||||
IOBUF PORT "o_rvaild" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
|
||||||
IOBUF PORT "o_wready" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_wready" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "i_sys_clk" DRIVE=NA IO_TYPE=LVCMOS33 SLEWRATE=NA PULLMODE=DOWN ;
|
IOBUF PORT "i_sys_clk" DRIVE=NA IO_TYPE=LVCMOS33 SLEWRATE=NA PULLMODE=DOWN ;
|
||||||
IOBUF PORT "o_err" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "o_err" IO_TYPE=LVCMOS33 ;
|
||||||
@@ -54,194 +53,261 @@ LOCATE COMP "o_DMM_EN[15]" SITE "V13" ;
|
|||||||
LOCATE COMP "o_IO_RC1" SITE "F10" ;
|
LOCATE COMP "o_IO_RC1" SITE "F10" ;
|
||||||
IOBUF PORT "o_IO_RC1" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "o_IO_RC1" IO_TYPE=LVCMOS33 ;
|
||||||
BLOCK JTAGPATHS ;
|
BLOCK JTAGPATHS ;
|
||||||
LOCATE COMP "o_OC_1[0]" SITE "M19" ;
|
LOCATE COMP "o_PMU_OC_1[0]" SITE "M19" ;
|
||||||
LOCATE COMP "o_OC_1[1]" SITE "R16" ;
|
LOCATE COMP "o_PMU_OC_1[1]" SITE "R16" ;
|
||||||
LOCATE COMP "o_OC_1[2]" SITE "N20" ;
|
LOCATE COMP "o_PMU_OC_1[2]" SITE "N20" ;
|
||||||
LOCATE COMP "o_OC_1[3]" SITE "P20" ;
|
LOCATE COMP "o_PMU_OC_1[3]" SITE "P20" ;
|
||||||
LOCATE COMP "o_OC_1[4]" SITE "G19" ;
|
LOCATE COMP "o_PMU_OC_1[4]" SITE "G19" ;
|
||||||
LOCATE COMP "o_OC_1[5]" SITE "J19" ;
|
LOCATE COMP "o_PMU_OC_1[5]" SITE "J19" ;
|
||||||
LOCATE COMP "o_OC_1[6]" SITE "H16" ;
|
LOCATE COMP "o_PMU_OC_1[6]" SITE "H16" ;
|
||||||
LOCATE COMP "o_OC_1[7]" SITE "J17" ;
|
LOCATE COMP "o_PMU_OC_1[7]" SITE "J17" ;
|
||||||
LOCATE COMP "o_OC_1[16]" SITE "W6" ;
|
LOCATE COMP "o_PMU_OC_1[16]" SITE "W6" ;
|
||||||
LOCATE COMP "o_OC_1[17]" SITE "AA7" ;
|
LOCATE COMP "o_PMU_OC_1[17]" SITE "AA7" ;
|
||||||
LOCATE COMP "o_OC_1[18]" SITE "AB6" ;
|
LOCATE COMP "o_PMU_OC_1[18]" SITE "AB6" ;
|
||||||
LOCATE COMP "o_OC_1[19]" SITE "Y7" ;
|
LOCATE COMP "o_PMU_OC_1[19]" SITE "Y7" ;
|
||||||
LOCATE COMP "o_OC_1[20]" SITE "V4" ;
|
LOCATE COMP "o_PMU_OC_1[20]" SITE "V4" ;
|
||||||
LOCATE COMP "o_OC_1[21]" SITE "R6" ;
|
LOCATE COMP "o_PMU_OC_1[21]" SITE "R6" ;
|
||||||
LOCATE COMP "o_OC_1[22]" SITE "U4" ;
|
LOCATE COMP "o_PMU_OC_1[22]" SITE "U4" ;
|
||||||
LOCATE COMP "o_OC_1[23]" SITE "T5" ;
|
LOCATE COMP "o_PMU_OC_1[23]" SITE "T5" ;
|
||||||
LOCATE COMP "o_OC_2[0]" SITE "E16" ;
|
LOCATE COMP "o_PMU_OC_2[0]" SITE "E16" ;
|
||||||
LOCATE COMP "o_OC_2[1]" SITE "F16" ;
|
LOCATE COMP "o_PMU_OC_2[1]" SITE "F16" ;
|
||||||
LOCATE COMP "o_OC_2[2]" SITE "D16" ;
|
LOCATE COMP "o_PMU_OC_2[2]" SITE "D16" ;
|
||||||
LOCATE COMP "o_OC_2[3]" SITE "G15" ;
|
LOCATE COMP "o_PMU_OC_2[3]" SITE "G15" ;
|
||||||
LOCATE COMP "o_OC_2[4]" SITE "C22" ;
|
LOCATE COMP "o_PMU_OC_2[4]" SITE "C22" ;
|
||||||
LOCATE COMP "o_OC_2[5]" SITE "D20" ;
|
LOCATE COMP "o_PMU_OC_2[5]" SITE "D20" ;
|
||||||
LOCATE COMP "o_OC_2[6]" SITE "D21" ;
|
LOCATE COMP "o_PMU_OC_2[6]" SITE "D21" ;
|
||||||
LOCATE COMP "o_OC_2[7]" SITE "D22" ;
|
LOCATE COMP "o_PMU_OC_2[7]" SITE "D22" ;
|
||||||
LOCATE COMP "o_OC_2[16]" SITE "A17" ;
|
LOCATE COMP "o_PMU_OC_2[16]" SITE "A17" ;
|
||||||
LOCATE COMP "o_OC_2[17]" SITE "A18" ;
|
LOCATE COMP "o_PMU_OC_2[17]" SITE "A18" ;
|
||||||
LOCATE COMP "o_OC_2[18]" SITE "C18" ;
|
LOCATE COMP "o_PMU_OC_2[18]" SITE "C18" ;
|
||||||
LOCATE COMP "o_OC_2[19]" SITE "D18" ;
|
LOCATE COMP "o_PMU_OC_2[19]" SITE "D18" ;
|
||||||
LOCATE COMP "o_OC_2[20]" SITE "G13" ;
|
LOCATE COMP "o_PMU_OC_2[20]" SITE "G13" ;
|
||||||
LOCATE COMP "o_OC_2[21]" SITE "F15" ;
|
LOCATE COMP "o_PMU_OC_2[21]" SITE "F15" ;
|
||||||
LOCATE COMP "o_OC_2[22]" SITE "F13" ;
|
LOCATE COMP "o_PMU_OC_2[22]" SITE "F13" ;
|
||||||
LOCATE COMP "o_OC_2[23]" SITE "G12" ;
|
LOCATE COMP "o_PMU_OC_2[23]" SITE "G12" ;
|
||||||
LOCATE COMP "o_OC_3[0]" SITE "M3" ;
|
LOCATE COMP "o_PMU_OC_3[0]" SITE "M3" ;
|
||||||
LOCATE COMP "o_OC_3[1]" SITE "R1" ;
|
LOCATE COMP "o_PMU_OC_3[1]" SITE "R1" ;
|
||||||
LOCATE COMP "o_OC_3[2]" SITE "N2" ;
|
LOCATE COMP "o_PMU_OC_3[2]" SITE "N2" ;
|
||||||
LOCATE COMP "o_OC_3[3]" SITE "N1" ;
|
LOCATE COMP "o_PMU_OC_3[3]" SITE "N1" ;
|
||||||
LOCATE COMP "o_OC_3[4]" SITE "F19" ;
|
LOCATE COMP "o_PMU_OC_3[4]" SITE "F19" ;
|
||||||
LOCATE COMP "o_OC_3[5]" SITE "E19" ;
|
LOCATE COMP "o_PMU_OC_3[5]" SITE "E19" ;
|
||||||
LOCATE COMP "o_OC_3[7]" SITE "B20" ;
|
LOCATE COMP "o_PMU_OC_3[7]" SITE "B20" ;
|
||||||
LOCATE COMP "o_OC_3[6]" SITE "C20" ;
|
LOCATE COMP "o_PMU_OC_3[6]" SITE "C20" ;
|
||||||
LOCATE COMP "o_OC_3[16]" SITE "E8" ;
|
LOCATE COMP "o_PMU_OC_3[16]" SITE "E8" ;
|
||||||
LOCATE COMP "o_OC_3[17]" SITE "E9" ;
|
LOCATE COMP "o_PMU_OC_3[17]" SITE "E9" ;
|
||||||
LOCATE COMP "o_OC_3[18]" SITE "E10" ;
|
LOCATE COMP "o_PMU_OC_3[18]" SITE "E10" ;
|
||||||
LOCATE COMP "o_OC_3[19]" SITE "D11" ;
|
LOCATE COMP "o_PMU_OC_3[19]" SITE "D11" ;
|
||||||
LOCATE COMP "o_OC_3[20]" SITE "E7" ;
|
LOCATE COMP "o_PMU_OC_3[20]" SITE "E7" ;
|
||||||
LOCATE COMP "o_OC_3[21]" SITE "D8" ;
|
LOCATE COMP "o_PMU_OC_3[21]" SITE "D8" ;
|
||||||
LOCATE COMP "o_OC_3[22]" SITE "B8" ;
|
LOCATE COMP "o_PMU_OC_3[22]" SITE "B8" ;
|
||||||
LOCATE COMP "o_OC_4[0]" SITE "A13" ;
|
LOCATE COMP "o_PMU_OC_4[0]" SITE "A13" ;
|
||||||
LOCATE COMP "o_OC_4[1]" SITE "B13" ;
|
LOCATE COMP "o_PMU_OC_4[1]" SITE "B13" ;
|
||||||
LOCATE COMP "o_OC_4[2]" SITE "B14" ;
|
LOCATE COMP "o_PMU_OC_4[2]" SITE "B14" ;
|
||||||
LOCATE COMP "o_OC_4[3]" SITE "B15" ;
|
LOCATE COMP "o_PMU_OC_4[3]" SITE "B15" ;
|
||||||
LOCATE COMP "o_OC_4[4]" SITE "B19" ;
|
LOCATE COMP "o_PMU_OC_4[4]" SITE "B19" ;
|
||||||
LOCATE COMP "o_OC_4[5]" SITE "D12" ;
|
LOCATE COMP "o_PMU_OC_4[5]" SITE "D12" ;
|
||||||
LOCATE COMP "o_OC_4[6]" SITE "E14" ;
|
LOCATE COMP "o_PMU_OC_4[6]" SITE "E14" ;
|
||||||
LOCATE COMP "o_OC_4[7]" SITE "E15" ;
|
LOCATE COMP "o_PMU_OC_4[7]" SITE "E15" ;
|
||||||
LOCATE COMP "o_OC_4[16]" SITE "C15" ;
|
LOCATE COMP "o_PMU_OC_4[16]" SITE "C15" ;
|
||||||
LOCATE COMP "o_OC_4[17]" SITE "A16" ;
|
LOCATE COMP "o_PMU_OC_4[17]" SITE "A16" ;
|
||||||
LOCATE COMP "o_OC_4[18]" SITE "B16" ;
|
LOCATE COMP "o_PMU_OC_4[18]" SITE "B16" ;
|
||||||
LOCATE COMP "o_OC_4[19]" SITE "C16" ;
|
LOCATE COMP "o_PMU_OC_4[19]" SITE "C16" ;
|
||||||
LOCATE COMP "o_OC_4[20]" SITE "E12" ;
|
LOCATE COMP "o_PMU_OC_4[20]" SITE "E12" ;
|
||||||
LOCATE COMP "o_OC_4[21]" SITE "A21" ;
|
LOCATE COMP "o_PMU_OC_4[21]" SITE "A21" ;
|
||||||
LOCATE COMP "o_OC_4[22]" SITE "B22" ;
|
LOCATE COMP "o_PMU_OC_4[22]" SITE "B22" ;
|
||||||
LOCATE COMP "o_OC_4[23]" SITE "C21" ;
|
LOCATE COMP "o_PMU_OC_4[23]" SITE "C21" ;
|
||||||
IOBUF PORT "o_OC_1[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE DRIVE=8 ;
|
IOBUF PORT "o_PMU_OC_1[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE DRIVE=8 ;
|
||||||
IOBUF PORT "o_OC_1[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[8]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[8]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[8]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[8]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[8]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[8]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[8]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[8]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[0]" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "o_PMU_OC_1[0]" IO_TYPE=LVCMOS33 ;
|
||||||
IOBUF PORT "o_OC_1[16]" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "o_PMU_OC_1[16]" IO_TYPE=LVCMOS33 ;
|
||||||
IOBUF PORT "o_OC_2[0]" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "o_PMU_OC_2[0]" IO_TYPE=LVCMOS33 ;
|
||||||
IOBUF PORT "o_OC_2[16]" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "o_PMU_OC_2[16]" IO_TYPE=LVCMOS33 ;
|
||||||
IOBUF PORT "o_OC_3[0]" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "o_PMU_OC_3[0]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[16]" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "o_PMU_OC_3[16]" IO_TYPE=LVCMOS33 ;
|
||||||
IOBUF PORT "o_OC_4[0]" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "o_PMU_OC_4[0]" IO_TYPE=LVCMOS33 ;
|
||||||
IOBUF PORT "o_OC_4[16]" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "o_PMU_OC_4[16]" IO_TYPE=LVCMOS33 ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[1]" SITE "M4" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[2]" SITE "B10" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[3]" SITE "P3" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[4]" SITE "F5" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[5]" SITE "G10" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[6]" SITE "F6" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[7]" SITE "C8" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[8]" SITE "B7" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[9]" SITE "F8" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[10]" SITE "C5" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[11]" SITE "A3" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[12]" SITE "B11" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[13]" SITE "A5" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[14]" SITE "B4" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[15]" SITE "F11" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[16]" SITE "D9" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[17]" SITE "N5" ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[0]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[1]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[2]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[3]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[4]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[5]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[6]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[7]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[8]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[9]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[10]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[11]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[12]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[13]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[14]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[15]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[16]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_RLSel[17]" IO_TYPE=LVCMOS33 ;
|
||||||
|
LOCATE COMP "o_RC_LOF[0]" SITE "F3" ;
|
||||||
|
LOCATE COMP "o_RC_LOF[1]" SITE "H4" ;
|
||||||
|
LOCATE COMP "o_RC_LOS[0]" SITE "G4" ;
|
||||||
|
LOCATE COMP "o_RC_LOS[1]" SITE "L6" ;
|
||||||
|
LOCATE COMP "o_RC_RLSel[0]" SITE "M6" ;
|
||||||
|
IOBUF PORT "o_RC_LOF[0]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_LOF[1]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_LOS[0]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_LOS[1]" IO_TYPE=LVCMOS33 ;
|
||||||
|
LOCATE COMP "o_RC_ISel" SITE "P6" ;
|
||||||
|
LOCATE COMP "o_RC_VSel" SITE "L7" ;
|
||||||
|
IOBUF PORT "o_RC_VSel" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_ISel" IO_TYPE=LVCMOS33 ;
|
||||||
|
LOCATE COMP "o_DMM_EN[16]" SITE "W11" ;
|
||||||
|
IOBUF PORT "o_DMM_EN[16]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_DMM_EN[17]" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_DMM_EN[18]" IO_TYPE=LVCMOS33 ;
|
||||||
|
LOCATE COMP "o_DMM_EN[17]" SITE "U10" ;
|
||||||
|
LOCATE COMP "o_DMM_EN[18]" SITE "T10" ;
|
||||||
|
LOCATE COMP "o_RC_T27" SITE "U13" ;
|
||||||
|
IOBUF PORT "o_RC_T27" IO_TYPE=LVCMOS33 ;
|
||||||
|
LOCATE COMP "o_RC_T28" SITE "U12" ;
|
||||||
|
LOCATE COMP "o_RC_T29" SITE "T12" ;
|
||||||
|
LOCATE COMP "o_RC_T30" SITE "T11" ;
|
||||||
|
LOCATE COMP "o_RC_T31" SITE "U11" ;
|
||||||
|
LOCATE COMP "o_RC_T32" SITE "V11" ;
|
||||||
|
IOBUF PORT "o_RC_T28" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_T29" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_T30" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_T31" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_RC_T32" IO_TYPE=LVCMOS33 ;
|
||||||
|
IOBUF PORT "o_con_done" IO_TYPE=LVCMOS33 ;
|
||||||
|
|||||||
+14
-2
@@ -18,16 +18,24 @@ module Reg_file (
|
|||||||
output o_exec,
|
output o_exec,
|
||||||
|
|
||||||
// Direct Register Outputs
|
// Direct Register Outputs
|
||||||
|
//Freq Regs
|
||||||
output [23:0] o_freq1,
|
output [23:0] o_freq1,
|
||||||
output [23:0] o_freq2,
|
output [23:0] o_freq2,
|
||||||
output [23:0] o_freq3,
|
output [23:0] o_freq3,
|
||||||
output [23:0] o_freq4
|
output [23:0] o_freq4,
|
||||||
|
|
||||||
|
//DC Regs
|
||||||
|
output [23:0] o_DC1,
|
||||||
|
output [23:0] o_DC2,
|
||||||
|
output [23:0] o_DC3,
|
||||||
|
output [23:0] o_DC4
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// --- Parameters ---
|
// --- Parameters ---
|
||||||
localparam REG_COUNT = 16;
|
localparam REG_COUNT = 16;
|
||||||
localparam [23:0]
|
localparam [23:0]
|
||||||
IDENT = 24'h200000 || 12'b0001_0000_0000, //CPLD1==1,version=1.0.0
|
IDENT = 24'h200000 | 12'b0001_0001_0000, //CPLD1==1,version=1.1.0
|
||||||
STATE_INIT = 24'h800000;
|
STATE_INIT = 24'h800000;
|
||||||
|
|
||||||
// State Machine Definition
|
// State Machine Definition
|
||||||
@@ -163,5 +171,9 @@ module Reg_file (
|
|||||||
assign o_freq2 = regtable[3];
|
assign o_freq2 = regtable[3];
|
||||||
assign o_freq3 = regtable[4];
|
assign o_freq3 = regtable[4];
|
||||||
assign o_freq4 = regtable[5];
|
assign o_freq4 = regtable[5];
|
||||||
|
assign o_DC1 = regtable[6];
|
||||||
|
assign o_DC2 = regtable[7];
|
||||||
|
assign o_DC3 = regtable[8];
|
||||||
|
assign o_DC4 = regtable[9];
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
+83
-21
@@ -6,7 +6,7 @@ module RelayConTop (
|
|||||||
input i_mosi,
|
input i_mosi,
|
||||||
input i_cs,
|
input i_cs,
|
||||||
output o_miso,
|
output o_miso,
|
||||||
output o_rvalid,
|
//output o_rvalid,
|
||||||
input i_rready,
|
input i_rready,
|
||||||
input i_wvalid,
|
input i_wvalid,
|
||||||
output o_wready,
|
output o_wready,
|
||||||
@@ -19,15 +19,24 @@ module RelayConTop (
|
|||||||
output o_RC_T29,
|
output o_RC_T29,
|
||||||
output o_RC_T30,
|
output o_RC_T30,
|
||||||
output o_RC_T31,
|
output o_RC_T31,
|
||||||
output [31:0]o_OC_1,
|
output o_RC_T32,
|
||||||
output [31:0]o_OC_2,
|
|
||||||
output [31:0]o_OC_3,
|
output [17:0]o_RC_RLSel,
|
||||||
output [31:0]o_OC_4
|
output o_RC_VSel,
|
||||||
|
output o_RC_ISel,
|
||||||
|
|
||||||
|
output [1:0]o_RC_LOF, //Strange DMM_N port relay
|
||||||
|
output [1:0]o_RC_LOS,
|
||||||
|
|
||||||
|
output [31:0]o_PMU_OC_1,
|
||||||
|
output [31:0]o_PMU_OC_2,
|
||||||
|
output [31:0]o_PMU_OC_3,
|
||||||
|
output [31:0]o_PMU_OC_4
|
||||||
|
|
||||||
);
|
);
|
||||||
wire [3:0]OC_x01;
|
wire [3:0]OC_x01;
|
||||||
wire [3:0]OC_x17;
|
wire [3:0]OC_x17;
|
||||||
wire [4:0]RC_Tx;
|
wire [5:0]RC_Tx;
|
||||||
|
|
||||||
wire [18:0]DMM_EN;
|
wire [18:0]DMM_EN;
|
||||||
wire IO_RC1;
|
wire IO_RC1;
|
||||||
@@ -49,6 +58,27 @@ module RelayConTop (
|
|||||||
wire [23:0]freq2_relay ;
|
wire [23:0]freq2_relay ;
|
||||||
wire [23:0]freq3_relay ;
|
wire [23:0]freq3_relay ;
|
||||||
wire [23:0]freq4_relay ;
|
wire [23:0]freq4_relay ;
|
||||||
|
|
||||||
|
//DC Control Reg output
|
||||||
|
wire [23:0]DC_Con1 ;
|
||||||
|
wire [23:0]DC_Con2 ;
|
||||||
|
wire [23:0]DC_Con3 ;
|
||||||
|
wire [23:0]DC_Con4 ;
|
||||||
|
|
||||||
|
//PMU OC Control
|
||||||
|
wire [31:0]PMU_OC_1 ;
|
||||||
|
wire [31:0]PMU_OC_2 ;
|
||||||
|
wire [31:0]PMU_OC_3 ;
|
||||||
|
wire [31:0]PMU_OC_4 ;
|
||||||
|
|
||||||
|
//RL Control
|
||||||
|
wire [17:0]RC_RLSel ;
|
||||||
|
|
||||||
|
//DMM V Select
|
||||||
|
wire RC_VSel;
|
||||||
|
//DMM I Select
|
||||||
|
wire RC_ISel;
|
||||||
|
|
||||||
wire con_rvalid;
|
wire con_rvalid;
|
||||||
|
|
||||||
wire con_done;
|
wire con_done;
|
||||||
@@ -63,7 +93,7 @@ module RelayConTop (
|
|||||||
.i_wvalid(i_wvalid),
|
.i_wvalid(i_wvalid),
|
||||||
.i_reg_busy(reg_busy),
|
.i_reg_busy(reg_busy),
|
||||||
.i_rdata(r_data),
|
.i_rdata(r_data),
|
||||||
.o_cmd_valid(cmd_vaild),
|
.o_cmd_valid(cmd_valid),
|
||||||
.o_wr(wr_flag),
|
.o_wr(wr_flag),
|
||||||
.o_miso(o_miso),
|
.o_miso(o_miso),
|
||||||
.o_rvalid(o_rvalid),
|
.o_rvalid(o_rvalid),
|
||||||
@@ -76,7 +106,7 @@ module RelayConTop (
|
|||||||
Reg_file CPLD_Reg_1(
|
Reg_file CPLD_Reg_1(
|
||||||
.i_sys_clk(i_sys_clk),
|
.i_sys_clk(i_sys_clk),
|
||||||
.i_rst_n(i_rst_n),
|
.i_rst_n(i_rst_n),
|
||||||
.i_wr_req(cmd_vaild),
|
.i_wr_req(cmd_valid),
|
||||||
.i_wr(wr_flag),
|
.i_wr(wr_flag),
|
||||||
.i_addr(reg_addr),
|
.i_addr(reg_addr),
|
||||||
.i_wdata(w_data),
|
.i_wdata(w_data),
|
||||||
@@ -85,6 +115,10 @@ module RelayConTop (
|
|||||||
.o_freq2(freq2_relay), //Freq_Slot2
|
.o_freq2(freq2_relay), //Freq_Slot2
|
||||||
.o_freq3(freq3_relay), //Freq_Slot3
|
.o_freq3(freq3_relay), //Freq_Slot3
|
||||||
.o_freq4(freq4_relay), //Freq_Slot4
|
.o_freq4(freq4_relay), //Freq_Slot4
|
||||||
|
.o_DC1(DC_Con1),
|
||||||
|
.o_DC2(DC_Con2),
|
||||||
|
.o_DC3(DC_Con3),
|
||||||
|
.o_DC4(DC_Con4),
|
||||||
.o_rvalid(con_rvalid),
|
.o_rvalid(con_rvalid),
|
||||||
.o_rdata(r_data),
|
.o_rdata(r_data),
|
||||||
.o_exec(con_exec), //Exec cmd
|
.o_exec(con_exec), //Exec cmd
|
||||||
@@ -100,39 +134,67 @@ module RelayConTop (
|
|||||||
.i_freq_relay2(freq2_relay),
|
.i_freq_relay2(freq2_relay),
|
||||||
.i_freq_relay3(freq3_relay),
|
.i_freq_relay3(freq3_relay),
|
||||||
.i_freq_relay4(freq4_relay),
|
.i_freq_relay4(freq4_relay),
|
||||||
|
.i_DC_Con1(DC_Con1),
|
||||||
|
.i_DC_Con2(DC_Con2),
|
||||||
|
.i_DC_Con3(DC_Con3),
|
||||||
|
.i_DC_Con4(DC_Con4),
|
||||||
.o_con_done(con_done),
|
.o_con_done(con_done),
|
||||||
.o_OC_x01(OC_x01),
|
.o_OC_x01(OC_x01),
|
||||||
.o_OC_x17(OC_x17),
|
.o_OC_x17(OC_x17),
|
||||||
.o_RC_Tx(RC_Tx),
|
.o_RC_Tx(RC_Tx),
|
||||||
.o_DMM_EN(DMM_EN),
|
.o_DMM_EN(DMM_EN),
|
||||||
|
.o_PMU_OC_1(PMU_OC_1),
|
||||||
|
.o_PMU_OC_2(PMU_OC_2),
|
||||||
|
.o_PMU_OC_3(PMU_OC_3),
|
||||||
|
.o_PMU_OC_4(PMU_OC_4),
|
||||||
|
.o_RC_VSel(RC_VSel),
|
||||||
|
.o_RC_ISel(RC_ISel),
|
||||||
|
.o_RC_RLSel(RC_RLSel),
|
||||||
.o_IO_RC1(IO_RC1),
|
.o_IO_RC1(IO_RC1),
|
||||||
.o_err(cpld_err_flag)
|
.o_err(cpld_err_flag)
|
||||||
);
|
);
|
||||||
|
|
||||||
assign o_con_done = con_done;
|
assign o_con_done = con_done;
|
||||||
//assign o_OC_x01 = OC_x01;
|
//assign o_OC_x01 = OC_x01;
|
||||||
assign o_OC_1[0] = OC_x01[0];
|
assign o_PMU_OC_1[0] = OC_x01[0];
|
||||||
assign o_OC_2[0] = OC_x01[1];
|
assign o_PMU_OC_2[0] = OC_x01[1];
|
||||||
assign o_OC_3[0] = OC_x01[2];
|
assign o_PMU_OC_3[0] = OC_x01[2];
|
||||||
assign o_OC_4[0] = OC_x01[3];
|
assign o_PMU_OC_4[0] = OC_x01[3];
|
||||||
|
|
||||||
//assign o_OC_x17 = OC_x17;
|
//assign o_OC_x17 = OC_x17;
|
||||||
assign o_OC_1[16] = OC_x17[0];
|
assign o_PMU_OC_1[16] = OC_x17[0];
|
||||||
assign o_OC_2[16] = OC_x17[1];
|
assign o_PMU_OC_2[16] = OC_x17[1];
|
||||||
assign o_OC_3[16] = OC_x17[2];
|
assign o_PMU_OC_3[16] = OC_x17[2];
|
||||||
assign o_OC_4[16] = OC_x17[3];
|
assign o_PMU_OC_4[16] = OC_x17[3];
|
||||||
|
|
||||||
|
assign o_PMU_OC_1[15:1] = PMU_OC_1[15:1];
|
||||||
|
assign o_PMU_OC_1[31:17] = PMU_OC_1[31:17];
|
||||||
|
|
||||||
|
assign o_PMU_OC_2[15:1] = PMU_OC_2[15:1];
|
||||||
|
assign o_PMU_OC_2[31:17] = PMU_OC_2[31:17];
|
||||||
|
|
||||||
|
assign o_PMU_OC_3[15:1] = PMU_OC_3[15:1];
|
||||||
|
assign o_PMU_OC_3[31:17] = PMU_OC_3[31:17];
|
||||||
|
|
||||||
|
assign o_PMU_OC_4[15:1] = PMU_OC_4[15:1];
|
||||||
|
assign o_PMU_OC_4[31:17] = PMU_OC_4[31:17];
|
||||||
|
|
||||||
assign o_DMM_EN = DMM_EN;
|
assign o_DMM_EN = DMM_EN;
|
||||||
assign o_IO_RC1 = IO_RC1;
|
assign o_IO_RC1 = IO_RC1;
|
||||||
|
|
||||||
assign o_RC_T27 = RC_Tx[4];
|
assign o_RC_T27 = RC_Tx[5];
|
||||||
assign o_RC_T28 = RC_Tx[3];
|
assign o_RC_T28 = RC_Tx[4];
|
||||||
assign o_RC_T29 = RC_Tx[2];
|
assign o_RC_T29 = RC_Tx[3];
|
||||||
assign o_RC_T30 = RC_Tx[1];
|
assign o_RC_T30 = RC_Tx[2];
|
||||||
assign o_RC_T31 = RC_Tx[0];
|
assign o_RC_T31 = RC_Tx[1];
|
||||||
|
assign o_RC_T32 = RC_Tx[0];
|
||||||
|
|
||||||
|
assign o_RC_RLSel = RC_RLSel;
|
||||||
|
assign o_RC_VSel = RC_VSel;
|
||||||
|
assign o_RC_ISel = RC_ISel;
|
||||||
|
|
||||||
|
assign o_RC_LOF = (RC_VSel == 1'b1)?2'b01:2'b10; //if Measure V then close RC_LOF[0]
|
||||||
|
assign o_RC_LOS = (RC_VSel == 1'b1)?2'b01:2'b10;
|
||||||
|
|
||||||
assign o_err = bus_err_flag || reg_err_flag ||cpld_err_flag;
|
assign o_err = bus_err_flag || reg_err_flag ||cpld_err_flag;
|
||||||
|
|
||||||
|
|||||||
+874
-270
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,2 @@
|
|||||||
"D:/WORK/ManLin/Verify/FPGA/Lattice/NewExtIns/CPLD1/CPLD_Freq_Con.v=work,"
|
"/home/ly0kos/work/prj/New_CalBoard/2.FW/CPLD1/tb_RelayConTop.sv=work,System Verilog"
|
||||||
"D:/WORK/ManLin/Verify/FPGA/Lattice/NewExtIns/CPLD1/Reg_file.v=work,"
|
"/home/ly0kos/work/prj/New_CalBoard/2.FW/CPLD1/RelayConTop_tf.v=work,Verilog 2001"
|
||||||
"D:/WORK/ManLin/Verify/FPGA/Lattice/NewExtIns/CPLD1/BUS_Con.v=work,"
|
|
||||||
"D:/WORK/ManLin/Verify/FPGA/Lattice/NewExtIns/CPLD1/RelayConTop.v=work,"
|
|
||||||
"D:/WORK/ManLin/Verify/FPGA/Lattice/NewExtIns/CPLD1/tb_RelayConTop.sv=work,"
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[Runmanager]
|
[Runmanager]
|
||||||
Geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\x1!\0\0\0\xe1\0\0\0\0\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\0\0\0\0\0\0)
|
Geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\x1!\0\0\0\xdd\0\0\0\0\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\0\0\0\0\0\0)
|
||||||
windowState=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\0\0\0\x6/\0\0\x2\x81\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\x1\0\0\0\0\0\0\0\x1\xff\xff\xff\xff\x3\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0)
|
windowState=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\0\0\0\x6/\0\0\x2\x81\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\x1\0\0\0\0\0\0\0\x1\xff\xff\xff\xff\x3\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0)
|
||||||
headerState=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\x1\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x16\0\xe0?\0\0\0\t\0\0\0\x10\0\0\0\x64\0\0\0\xf\0\0\0\x64\0\0\0\xe\0\0\0\x64\0\0\0\r\0\0\0\x64\0\0\0\x15\0\0\0\x64\0\0\0\x14\0\0\0\x64\0\0\0\x13\0\0\0\x64\0\0\0\x12\0\0\0\x64\0\0\0\x11\0\0\0\x64\0\0\x6+\0\0\0\x16\x1\x1\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x4\0\0\0#\0\0\0\x1\0\0\0\x2\0\0\x4L\0\0\0\v\0\0\0\0\0\0\x1\xbc\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\t\0\0\0\0)
|
headerState=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\x1\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\x16\0\xe0?\0\0\0\t\0\0\0\x10\0\0\0\x64\0\0\0\xf\0\0\0\x64\0\0\0\xe\0\0\0\x64\0\0\0\r\0\0\0\x64\0\0\0\x15\0\0\0\x64\0\0\0\x14\0\0\0\x64\0\0\0\x13\0\0\0\x64\0\0\0\x12\0\0\0\x64\0\0\0\x11\0\0\0\x64\0\0\x6+\0\0\0\x16\x1\x1\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x4\0\0\0#\0\0\0\x1\0\0\0\x2\0\0\x4L\0\0\0\v\0\0\0\0\0\0\x1\xbc\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\t\0\0\0\0)
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ pin_sort_type=0
|
|||||||
pin_sort_ascending=true
|
pin_sort_ascending=true
|
||||||
sig_sort_type=0
|
sig_sort_type=0
|
||||||
sig_sort_ascending=true
|
sig_sort_ascending=true
|
||||||
active_Sheet=Global Preferences
|
active_Sheet=Port Assignments
|
||||||
|
|
||||||
[Port%20Assignments]
|
[Port%20Assignments]
|
||||||
Name="176,0"
|
Name="216,0"
|
||||||
Group%20By="118,1"
|
Group%20By="118,1"
|
||||||
Pin="71,2"
|
Pin="71,2"
|
||||||
BANK="91,3"
|
BANK="91,3"
|
||||||
@@ -65,7 +65,7 @@ Prioritize="100,ELLIPSIS"
|
|||||||
[Timing%20Preferences]
|
[Timing%20Preferences]
|
||||||
Preference%20Name="146,ELLIPSIS"
|
Preference%20Name="146,ELLIPSIS"
|
||||||
Preference%20Value="143,ELLIPSIS"
|
Preference%20Value="143,ELLIPSIS"
|
||||||
Preference%20Unit="1122,ELLIPSIS"
|
Preference%20Unit="133,ELLIPSIS"
|
||||||
|
|
||||||
[Group]
|
[Group]
|
||||||
Group%20Type\Name="153,ELLIPSIS"
|
Group%20Type\Name="153,ELLIPSIS"
|
||||||
|
|||||||
+17
-17
@@ -9,14 +9,14 @@ module BUS_Con (
|
|||||||
output o_miso, // <-- MISO Logic added here
|
output o_miso, // <-- MISO Logic added here
|
||||||
|
|
||||||
// Local Interface
|
// Local Interface
|
||||||
output o_rvaild, // (Typo in original: o_rvalid)
|
output o_rvalid, // (Typo in original: o_rvalid)
|
||||||
input i_rvaild, // Valid signal from Backend (Data is ready)
|
input i_rvalid, // Valid signal from Backend (Data is ready)
|
||||||
input i_wvaild,
|
input i_wvalid,
|
||||||
output o_wready,
|
output o_wready,
|
||||||
input i_reg_busy,
|
input i_reg_busy,
|
||||||
input [23:0] i_rdata, // Data from Backend to send to Master
|
input [23:0] i_rdata, // Data from Backend to send to Master
|
||||||
output o_wr,
|
output o_wr,
|
||||||
output o_cmd_vaild,
|
output o_cmd_valid,
|
||||||
output [23:0] o_data,
|
output [23:0] o_data,
|
||||||
output [6:0] o_addr,
|
output [6:0] o_addr,
|
||||||
output o_err
|
output o_err
|
||||||
@@ -61,19 +61,19 @@ module BUS_Con (
|
|||||||
reg err_flag;
|
reg err_flag;
|
||||||
reg [1:0] state;
|
reg [1:0] state;
|
||||||
//
|
//
|
||||||
reg [31:0] tx_buffer; // Holds data waiting for the next CS Low
|
reg [31:0] tx_buffer; // Holds data waiting for the next CS Low
|
||||||
reg [31:0] miso_shift; // The actual shifter
|
reg [31:0] miso_shift; // The actual shifter
|
||||||
// Output Registers
|
// Output Registers
|
||||||
reg [6:0] addr_out;
|
reg [6:0] addr_out;
|
||||||
reg [23:0] data_out;
|
reg [23:0] data_out;
|
||||||
reg wr_out;
|
reg wr_out;
|
||||||
reg cmd_valid_out;
|
reg cmd_valid_out;
|
||||||
|
|
||||||
//
|
//
|
||||||
localparam IDLE = 2'b00;
|
localparam IDLE = 2'b00;
|
||||||
localparam CMD_SENT = 2'b01;
|
localparam CMD_SENT = 2'b01;
|
||||||
localparam WAIT_BUSY = 2'b10;
|
localparam WAIT_BUSY = 2'b10;
|
||||||
localparam DONE = 2'b11;
|
localparam DONE = 2'b11;
|
||||||
|
|
||||||
|
|
||||||
always @(posedge i_sys_clk) begin
|
always @(posedge i_sys_clk) begin
|
||||||
@@ -122,7 +122,7 @@ module BUS_Con (
|
|||||||
end else begin
|
end else begin
|
||||||
// If backend provides valid read data, store it.
|
// If backend provides valid read data, store it.
|
||||||
// We pad the top 8 bits with Zeros (or you can put status flags here)
|
// We pad the top 8 bits with Zeros (or you can put status flags here)
|
||||||
if (i_rvaild) begin
|
if (i_rvalid) begin
|
||||||
tx_buffer <= {8'h00, i_rdata};
|
tx_buffer <= {8'h00, i_rdata};
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -205,11 +205,11 @@ module BUS_Con (
|
|||||||
assign o_addr = addr_out;
|
assign o_addr = addr_out;
|
||||||
assign o_data = data_out;
|
assign o_data = data_out;
|
||||||
assign o_wr = wr_out;
|
assign o_wr = wr_out;
|
||||||
assign o_cmd_vaild = cmd_valid_out;
|
assign o_cmd_valid = cmd_valid_out;
|
||||||
assign o_err = err_flag;
|
assign o_err = err_flag;
|
||||||
assign o_wready = (state == IDLE);
|
assign o_wready = (state == IDLE);
|
||||||
|
|
||||||
// Pass through unused signal or hook it up if needed
|
// Pass through unused signal or hook it up if needed
|
||||||
assign o_rvaild = 1'b0;
|
assign o_rvalid = i_rvalid;
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
+232
-95
@@ -2,32 +2,61 @@ module CPLD_Con (
|
|||||||
input i_sys_clk,
|
input i_sys_clk,
|
||||||
input i_rst_n,
|
input i_rst_n,
|
||||||
input i_con_exec,
|
input i_con_exec,
|
||||||
|
|
||||||
|
// Freq Relay Control
|
||||||
input [23:0]i_freq_relay1,
|
input [23:0]i_freq_relay1,
|
||||||
input [23:0]i_freq_relay2,
|
input [23:0]i_freq_relay2,
|
||||||
input [23:0]i_freq_relay3,
|
input [23:0]i_freq_relay3,
|
||||||
input [23:0]i_freq_relay4,
|
input [23:0]i_freq_relay4,
|
||||||
output o_con_done,
|
|
||||||
|
// DC related Control
|
||||||
|
input [23:0]i_DC_Con1,
|
||||||
|
input [23:0]i_DC_Con2,
|
||||||
|
input [23:0]i_DC_Con3,
|
||||||
|
input [23:0]i_DC_Con4,
|
||||||
|
|
||||||
|
//Output RELAYs
|
||||||
output [7:0]o_RC_F, //Ref: Schematic
|
output [7:0]o_RC_F, //Ref: Schematic
|
||||||
output [15:0]o_RC_S,
|
output [15:0]o_RC_S,
|
||||||
output [31:0]o_RC_T,
|
output [31:0]o_RC_T,
|
||||||
output [3:0] o_OC_x09,
|
output [3:0] o_OC_x09,
|
||||||
output [3:0] o_OC_x25
|
output [3:0] o_OC_x25,
|
||||||
|
|
||||||
|
output [31:0]o_PMU_OC_1 ,
|
||||||
|
output [31:0]o_PMU_OC_2 ,
|
||||||
|
output [31:0]o_PMU_OC_3 ,
|
||||||
|
output [31:0]o_PMU_OC_4,
|
||||||
|
|
||||||
|
//Output FLAGs
|
||||||
|
output o_err,
|
||||||
|
output o_con_done
|
||||||
);
|
);
|
||||||
|
|
||||||
//Output Relay Reg
|
//Output Relay Reg
|
||||||
reg [3:0] OC_x09;
|
reg [3:0] OC_x09;
|
||||||
reg [3:0] OC_x25;
|
reg [3:0] OC_x25;
|
||||||
|
|
||||||
|
//Condition Tester
|
||||||
|
reg [15:0]en_t ;
|
||||||
|
reg freq_t;
|
||||||
|
reg dc_t;
|
||||||
|
|
||||||
//Relay Reg
|
//Relay Reg
|
||||||
reg [7:0]relay_l1;
|
reg [7:0]relay_l1;
|
||||||
reg [15:0]relay_l2 ;
|
reg [15:0]relay_l2 ;
|
||||||
reg [31:0]relay_l3 ;
|
reg [31:0]relay_l3 ;
|
||||||
|
|
||||||
|
reg [31:0]PMU_OC_1 ;
|
||||||
|
reg [31:0]PMU_OC_2 ;
|
||||||
|
reg [31:0]PMU_OC_3 ;
|
||||||
|
reg [31:0]PMU_OC_4 ;
|
||||||
|
|
||||||
//Flags
|
//Flags
|
||||||
reg exec_done_flag;
|
reg exec_done_flag;
|
||||||
reg exec_flag;
|
reg exec_flag;
|
||||||
|
|
||||||
reg [3:0]slot_exec_flag;
|
reg [3:0]freq_slot_flag;
|
||||||
|
reg [3:0]dc_slot_flag ;
|
||||||
reg err_flag;
|
reg err_flag;
|
||||||
|
|
||||||
//Counter
|
//Counter
|
||||||
@@ -52,6 +81,21 @@ module CPLD_Con (
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
//Function Identify
|
||||||
|
always @(posedge i_sys_clk) begin
|
||||||
|
if (i_rst_n == 1'b0) begin
|
||||||
|
en_t <= 'd0;
|
||||||
|
freq_t <= 'd0;
|
||||||
|
dc_t <= 'd0;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
en_t <= (i_freq_relay1[0] + i_freq_relay2[0] + i_freq_relay3[0] + i_freq_relay4[0]) + (i_DC_Con1[0] +i_DC_Con2[0] +i_DC_Con3[0] +i_DC_Con4[0] );
|
||||||
|
freq_t <= i_freq_relay1[0] + i_freq_relay2[0] + i_freq_relay3[0] + i_freq_relay4[0];
|
||||||
|
dc_t <= i_DC_Con1[0] +i_DC_Con2[0] +i_DC_Con3[0] +i_DC_Con4[0];
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
// Main Controller Function
|
||||||
always @(posedge i_sys_clk) begin
|
always @(posedge i_sys_clk) begin
|
||||||
if (i_rst_n == 1'b0) begin
|
if (i_rst_n == 1'b0) begin
|
||||||
relay_l1 <= 'd0;
|
relay_l1 <= 'd0;
|
||||||
@@ -59,125 +103,211 @@ module CPLD_Con (
|
|||||||
relay_l3 <= 'd0;
|
relay_l3 <= 'd0;
|
||||||
exec_flag <= 1'b0;
|
exec_flag <= 1'b0;
|
||||||
exec_done_flag <= 1'b1;
|
exec_done_flag <= 1'b1;
|
||||||
slot_exec_flag <= 'd0;
|
freq_slot_flag <= 'd0;
|
||||||
|
PMU_OC_1 <= 'd0;
|
||||||
|
PMU_OC_2 <= 'd0;
|
||||||
|
PMU_OC_3 <= 'd0;
|
||||||
|
PMU_OC_4 <= 'd0;
|
||||||
|
dc_slot_flag<='d0;
|
||||||
err_flag <= 'd0;
|
err_flag <= 'd0;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
if ((i_con_exec == 1'b1) & (exec_flag == 1'b0)) begin
|
if ((i_con_exec == 1'b1) & (exec_flag == 1'b0)) begin
|
||||||
exec_done_flag <= 'd0;
|
|
||||||
exec_flag <= 1'b1;
|
|
||||||
//To DO: More Sanity Check?
|
//To DO: More Sanity Check?
|
||||||
// Add the bits together. Verilog handles the width expansion automatically for the comparison.
|
if (en_t > 'd1) begin //Only ONE Enable bit should be set!
|
||||||
if ( (i_freq_relay1[0] + i_freq_relay2[0] + i_freq_relay3[0] + i_freq_relay4[0]) > 2'd1 ) begin
|
|
||||||
err_flag <= 1'b1;
|
err_flag <= 1'b1;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
slot_exec_flag[0] <= i_freq_relay1[0];
|
exec_done_flag <= 'd0;
|
||||||
slot_exec_flag[1] <= i_freq_relay2[0];
|
exec_flag <= 1'b1;
|
||||||
slot_exec_flag[2] <= i_freq_relay3[0];
|
|
||||||
slot_exec_flag[3] <= i_freq_relay4[0];
|
freq_slot_flag[0] <= i_freq_relay1[0];
|
||||||
|
freq_slot_flag[1] <= i_freq_relay2[0];
|
||||||
|
freq_slot_flag[2] <= i_freq_relay3[0];
|
||||||
|
freq_slot_flag[3] <= i_freq_relay4[0];
|
||||||
|
|
||||||
|
dc_slot_flag[0] <= i_DC_Con1[0];
|
||||||
|
dc_slot_flag[1] <= i_DC_Con2[0];
|
||||||
|
dc_slot_flag[2] <= i_DC_Con3[0];
|
||||||
|
dc_slot_flag[3] <= i_DC_Con4[0];
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else if (exec_flag == 1'b1) begin
|
else if (exec_flag == 1'b1) begin
|
||||||
//Output Relay
|
//Output Relay
|
||||||
case (slot_exec_flag)
|
if (freq_t == 1'b1) begin
|
||||||
4'b0001: begin
|
case (freq_slot_flag)
|
||||||
relay_l1 <= {'d0,i_freq_relay1[22],i_freq_relay1[23]};
|
4'b0001: begin
|
||||||
if (delay_cnt == 'd500) begin
|
relay_l1 <= {'d0,i_freq_relay1[22],i_freq_relay1[23]};
|
||||||
relay_l2 <= {'d0,i_freq_relay1[18],i_freq_relay1[19],i_freq_relay1[20],i_freq_relay1[21]};
|
if (delay_cnt == 'd500) begin
|
||||||
|
relay_l2 <= {'d0,i_freq_relay1[18],i_freq_relay1[19],i_freq_relay1[20],i_freq_relay1[21]};
|
||||||
|
end
|
||||||
|
else if (delay_cnt == 'd1000) begin
|
||||||
|
relay_l3 <= {'d0,i_freq_relay1[10],i_freq_relay1[11],i_freq_relay1[12],i_freq_relay1[13],i_freq_relay1[14],i_freq_relay1[15],i_freq_relay1[16],i_freq_relay1[17]};
|
||||||
|
end
|
||||||
|
else if (delay_cnt == 'd1080) begin
|
||||||
|
exec_flag <= 'd0;
|
||||||
|
exec_done_flag <= 1'b1;
|
||||||
|
end
|
||||||
|
if ((freq_relay1 > 64) & (freq_relay1 < 73)) begin
|
||||||
|
OC_x09 <= 4'b0001;
|
||||||
|
end
|
||||||
|
else if ((freq_relay1 > 192) & (freq_relay1 < 201)) begin
|
||||||
|
OC_x25 <= 4'b0001;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
OC_x09 <= 'd0;
|
||||||
|
OC_x25 <= 'd0;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else if (delay_cnt == 'd1000) begin
|
4'b0010: begin
|
||||||
relay_l3 <= {'d0,i_freq_relay1[10],i_freq_relay1[11],i_freq_relay1[12],i_freq_relay1[13],i_freq_relay1[14],i_freq_relay1[15],i_freq_relay1[16],i_freq_relay1[17]};
|
relay_l1 <= {4'd0,i_freq_relay2[22],i_freq_relay2[23],2'd0};
|
||||||
|
if (delay_cnt == 'd500) begin
|
||||||
|
relay_l2 <= {8'd0,i_freq_relay2[18],i_freq_relay2[19],i_freq_relay2[20],i_freq_relay2[21],4'd0};
|
||||||
|
end
|
||||||
|
else if (delay_cnt == 'd1000) begin
|
||||||
|
relay_l3 <= {16'd0,i_freq_relay2[10],i_freq_relay2[11],i_freq_relay2[12],i_freq_relay2[13],i_freq_relay2[14],i_freq_relay2[15],i_freq_relay2[16],i_freq_relay2[17],8'd0};
|
||||||
|
end
|
||||||
|
else if (delay_cnt == 'd1080) begin
|
||||||
|
exec_flag <= 'd0;
|
||||||
|
exec_done_flag <= 1'b1;
|
||||||
|
end
|
||||||
|
if ((freq_relay2 > 64) & (freq_relay2 < 73)) begin
|
||||||
|
OC_x09 <= 4'b0010;
|
||||||
|
end
|
||||||
|
else if ((freq_relay2 > 192) & (freq_relay2 < 201)) begin
|
||||||
|
OC_x25 <= 4'b0010;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
OC_x09 <= 'd0;
|
||||||
|
OC_x25 <= 'd0;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else if (delay_cnt == 'd1080) begin
|
4'b0100: begin
|
||||||
|
relay_l1 <= {2'd0,i_freq_relay3[22],i_freq_relay3[23],4'd0};
|
||||||
|
if (delay_cnt == 'd500) begin
|
||||||
|
relay_l2 <= {4'd0,i_freq_relay3[18],i_freq_relay3[19],i_freq_relay3[20],i_freq_relay3[21],8'd0};
|
||||||
|
end
|
||||||
|
else if (delay_cnt == 'd1000) begin
|
||||||
|
relay_l3 <= {8'd0,i_freq_relay3[12],i_freq_relay3[13],i_freq_relay3[10],i_freq_relay3[11],i_freq_relay3[16],i_freq_relay3[17],i_freq_relay3[14],i_freq_relay3[15],16'd0};
|
||||||
|
end
|
||||||
|
else if (delay_cnt == 'd1080) begin
|
||||||
|
exec_flag <= 'd0;
|
||||||
|
exec_done_flag <= 1'b1;
|
||||||
|
end
|
||||||
|
if ((freq_relay3 > 64) &(freq_relay3 <73)) begin
|
||||||
|
OC_x09 <= 4'b0100;
|
||||||
|
end
|
||||||
|
else if ((freq_relay3 > 192) & (freq_relay3 < 201)) begin
|
||||||
|
OC_x25 <= 4'b0100;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
OC_x09 <= 'd0;
|
||||||
|
OC_x25 <= 'd0;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
4'b1000: begin
|
||||||
|
relay_l1 <= {i_freq_relay4[22],i_freq_relay4[23],6'd0};
|
||||||
|
if (delay_cnt == 'd500) begin
|
||||||
|
relay_l2 <= {i_freq_relay4[18],i_freq_relay4[19],i_freq_relay4[20],i_freq_relay4[21],12'd0};
|
||||||
|
end
|
||||||
|
else if (delay_cnt == 'd1000) begin
|
||||||
|
relay_l3 <= {i_freq_relay4[10],i_freq_relay4[11],i_freq_relay4[12],i_freq_relay4[13],i_freq_relay4[14],i_freq_relay4[15],i_freq_relay4[16],i_freq_relay4[17],24'd0};
|
||||||
|
end
|
||||||
|
else if (delay_cnt == 'd1080) begin
|
||||||
|
exec_flag <= 'd0;
|
||||||
|
exec_done_flag <= 1'b1;
|
||||||
|
end
|
||||||
|
if ((freq_relay4 > 64) & (freq_relay4 < 73)) begin
|
||||||
|
OC_x09 <= 4'b1000;
|
||||||
|
end
|
||||||
|
else if ((freq_relay4 > 192) & (freq_relay4 < 201)) begin
|
||||||
|
OC_x25 <= 4'b1000;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
OC_x09 <= 'd0;
|
||||||
|
OC_x25 <= 'd0;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
default: begin
|
||||||
|
OC_x09 <= 4'b0000;
|
||||||
|
OC_x25 <= 4'b0000;
|
||||||
|
end
|
||||||
|
endcase
|
||||||
|
end
|
||||||
|
else if (dc_t == 1'b1) begin
|
||||||
|
case (dc_slot_flag)
|
||||||
|
4'b0001: begin
|
||||||
|
//Sanity Check
|
||||||
|
if ((i_DC_Con1[21:17] < 1) || (i_DC_Con1[21:17] > 18) || (i_DC_Con1[9:1] < 1) || (i_DC_Con1[9:1] > 256)) begin
|
||||||
|
err_flag <= 1'b1;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
if (i_DC_Con1[23] == 1'b0) begin //Select PMU
|
||||||
|
PMU_OC_1 <= (32'b0000_0000_0000_0000_0000_0000_0000_0001)<<(i_DC_Con1[9:1]/8);
|
||||||
|
end
|
||||||
|
else if (i_DC_Con1[23] == 1'b1) begin //Select DPS
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
exec_flag <= 'd0;
|
exec_flag <= 'd0;
|
||||||
exec_done_flag <= 1'b1;
|
exec_done_flag <= 1'b1;
|
||||||
end
|
end
|
||||||
if ((freq_relay1 > 64) & (freq_relay1 < 73)) begin
|
4'b0010: begin
|
||||||
OC_x09 <= 4'b0001;
|
//Sanity Check
|
||||||
end
|
if ((i_DC_Con2[21:17] < 1) || (i_DC_Con2[21:17] > 18) || (i_DC_Con2[9:1] < 1) || (i_DC_Con2[9:1] > 256)) begin
|
||||||
else if ((freq_relay1 > 192) & (freq_relay1 < 201)) begin
|
err_flag <= 1'b1;
|
||||||
OC_x25 <= 4'b0001;
|
end
|
||||||
end
|
else begin
|
||||||
else begin
|
if (i_DC_Con2[23] == 1'b0) begin //Select PMU
|
||||||
OC_x09 <= 'd0;
|
PMU_OC_2 <= (32'b0000_0000_0000_0000_0000_0000_0000_0001)<<(i_DC_Con2[9:1]/8);
|
||||||
OC_x25 <= 'd0;
|
end
|
||||||
end
|
else if (i_DC_Con2[23] == 1'b1) begin //Select DPS
|
||||||
end
|
|
||||||
4'b0010: begin
|
end
|
||||||
relay_l1 <= {4'd0,i_freq_relay2[22],i_freq_relay2[23],2'd0};
|
end
|
||||||
if (delay_cnt == 'd500) begin
|
|
||||||
relay_l2 <= {8'd0,i_freq_relay2[18],i_freq_relay2[19],i_freq_relay2[20],i_freq_relay2[21],4'd0};
|
|
||||||
end
|
|
||||||
else if (delay_cnt == 'd1000) begin
|
|
||||||
relay_l3 <= {16'd0,i_freq_relay2[10],i_freq_relay2[11],i_freq_relay2[12],i_freq_relay2[13],i_freq_relay2[14],i_freq_relay2[15],i_freq_relay2[16],i_freq_relay2[17],8'd0};
|
|
||||||
end
|
|
||||||
else if (delay_cnt == 'd1080) begin
|
|
||||||
exec_flag <= 'd0;
|
exec_flag <= 'd0;
|
||||||
exec_done_flag <= 1'b1;
|
exec_done_flag <= 1'b1;
|
||||||
end
|
end
|
||||||
if ((freq_relay2 > 64) & (freq_relay2 < 73)) begin
|
4'b0100:begin
|
||||||
OC_x09 <= 4'b0010;
|
//Sanity Check
|
||||||
end
|
if ((i_DC_Con3[21:17] < 1) || (i_DC_Con3[21:17] > 18) || (i_DC_Con3[9:1] < 1) || (i_DC_Con3[9:1] > 256)) begin
|
||||||
else if ((freq_relay2 > 192) & (freq_relay2 < 201)) begin
|
err_flag <= 1'b1;
|
||||||
OC_x25 <= 4'b0010;
|
end
|
||||||
end
|
else begin
|
||||||
else begin
|
if (i_DC_Con3[23] == 1'b0) begin //Select PMU
|
||||||
OC_x09 <= 'd0;
|
PMU_OC_3 <= (32'b0000_0000_0000_0000_0000_0000_0000_0001)<<(i_DC_Con3[9:1]/8);
|
||||||
OC_x25 <= 'd0;
|
end
|
||||||
end
|
else if (i_DC_Con3[23] == 1'b1) begin //Select DPS
|
||||||
end
|
|
||||||
4'b0100: begin
|
end
|
||||||
relay_l1 <= {2'd0,i_freq_relay3[22],i_freq_relay3[23],4'd0};
|
end
|
||||||
if (delay_cnt == 'd500) begin
|
|
||||||
relay_l2 <= {4'd0,i_freq_relay3[18],i_freq_relay3[19],i_freq_relay3[20],i_freq_relay3[21],8'd0};
|
|
||||||
end
|
|
||||||
else if (delay_cnt == 'd1000) begin
|
|
||||||
relay_l3 <= {8'd0,i_freq_relay3[12],i_freq_relay3[13],i_freq_relay3[10],i_freq_relay3[11],i_freq_relay3[16],i_freq_relay3[17],i_freq_relay3[14],i_freq_relay3[15],16'd0};
|
|
||||||
end
|
|
||||||
else if (delay_cnt == 'd1080) begin
|
|
||||||
exec_flag <= 'd0;
|
exec_flag <= 'd0;
|
||||||
exec_done_flag <= 1'b1;
|
exec_done_flag <= 1'b1;
|
||||||
end
|
end
|
||||||
if ((freq_relay3 > 64) &(freq_relay3 <73)) begin
|
4'b1000:begin
|
||||||
OC_x09 <= 4'b0100;
|
//Sanity Check
|
||||||
end
|
if ((i_DC_Con4[21:17] < 1) || (i_DC_Con4[21:17] > 18) || (i_DC_Con4[9:1] < 1) || (i_DC_Con4[9:1] > 256)) begin
|
||||||
else if ((freq_relay3 > 192) & (freq_relay3 < 201)) begin
|
err_flag <= 1'b1;
|
||||||
OC_x25 <= 4'b0100;
|
end
|
||||||
end
|
else begin
|
||||||
else begin
|
if (i_DC_Con4[23] == 1'b0) begin //Select PMU
|
||||||
OC_x09 <= 'd0;
|
PMU_OC_4 <= (32'b0000_0000_0000_0000_0000_0000_0000_0001)<<(i_DC_Con4[9:1]/8);
|
||||||
OC_x25 <= 'd0;
|
end
|
||||||
end
|
else if (i_DC_Con4[23] == 1'b1) begin //Select DPS
|
||||||
end
|
|
||||||
4'b1000: begin
|
end
|
||||||
relay_l1 <= {i_freq_relay4[22],i_freq_relay4[23],6'd0};
|
end
|
||||||
if (delay_cnt == 'd500) begin
|
|
||||||
relay_l2 <= {i_freq_relay4[18],i_freq_relay4[19],i_freq_relay4[20],i_freq_relay4[21],12'd0};
|
|
||||||
end
|
|
||||||
else if (delay_cnt == 'd1000) begin
|
|
||||||
relay_l3 <= {i_freq_relay4[10],i_freq_relay4[11],i_freq_relay4[12],i_freq_relay4[13],i_freq_relay4[14],i_freq_relay4[15],i_freq_relay4[16],i_freq_relay4[17],24'd0};
|
|
||||||
end
|
|
||||||
else if (delay_cnt == 'd1080) begin
|
|
||||||
exec_flag <= 'd0;
|
exec_flag <= 'd0;
|
||||||
exec_done_flag <= 1'b1;
|
exec_done_flag <= 1'b1;
|
||||||
end
|
end
|
||||||
if ((freq_relay4 > 64) & (freq_relay4 < 73)) begin
|
default:begin // You Should NOT be HERE
|
||||||
OC_x09 <= 4'b1000;
|
PMU_OC_1 <= 'd0 ;
|
||||||
|
PMU_OC_2 <= 'd0 ;
|
||||||
|
PMU_OC_3 <= 'd0 ;
|
||||||
|
PMU_OC_4 <= 'd0 ;
|
||||||
end
|
end
|
||||||
else if ((freq_relay4 > 192) & (freq_relay4 < 201)) begin
|
endcase
|
||||||
OC_x25 <= 4'b1000;
|
end
|
||||||
end
|
|
||||||
else begin
|
|
||||||
OC_x09 <= 'd0;
|
|
||||||
OC_x25 <= 'd0;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
default: begin
|
|
||||||
OC_x09 <= 4'b0000;
|
|
||||||
OC_x25 <= 4'b0000;
|
|
||||||
end
|
|
||||||
endcase
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -189,4 +319,11 @@ module CPLD_Con (
|
|||||||
assign o_OC_x09 = OC_x09;
|
assign o_OC_x09 = OC_x09;
|
||||||
assign o_OC_x25 = OC_x25;
|
assign o_OC_x25 = OC_x25;
|
||||||
|
|
||||||
|
assign o_PMU_OC_1 = PMU_OC_1;
|
||||||
|
assign o_PMU_OC_2 = PMU_OC_2;
|
||||||
|
assign o_PMU_OC_3 = PMU_OC_3;
|
||||||
|
assign o_PMU_OC_4 = PMU_OC_4;
|
||||||
|
|
||||||
|
assign o_err = err_flag;
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<BaliProject version="3.2" title="NewExtIns_CPLD2" device="LCMXO2-7000HC-4FG484C" default_implementation="impl1">
|
<BaliProject version="3.2" title="NewExtIns_CPLD2" device="LCMXO2-7000HC-4FG484C" default_implementation="impl1">
|
||||||
<Options/>
|
<Options/>
|
||||||
<Implementation title="impl1" dir="impl1" description="impl1" synthesis="synplify" default_strategy="Strategy1">
|
<Implementation title="impl1" dir="impl1" description="impl1" synthesis="synplify" default_strategy="Strategy1">
|
||||||
<Options def_top="RelayConTop"/>
|
<Options def_top="RelayConTop" top="RelayConTop"/>
|
||||||
<Source name="RelayConTop.v" type="Verilog" type_short="Verilog">
|
<Source name="RelayConTop.v" type="Verilog" type_short="Verilog">
|
||||||
<Options top_module="RelayConTop"/>
|
<Options top_module="RelayConTop"/>
|
||||||
</Source>
|
</Source>
|
||||||
|
|||||||
+200
-198
@@ -4,6 +4,7 @@ RVL_ALIAS "i_sys_clk" "i_sys_clk";
|
|||||||
RVL_ALIAS "i_sys_clk" "i_sys_clk";
|
RVL_ALIAS "i_sys_clk" "i_sys_clk";
|
||||||
RVL_ALIAS "i_sys_clk" "i_sys_clk";
|
RVL_ALIAS "i_sys_clk" "i_sys_clk";
|
||||||
RVL_ALIAS "i_sys_clk" "i_sys_clk";
|
RVL_ALIAS "i_sys_clk" "i_sys_clk";
|
||||||
|
RVL_ALIAS "i_sys_clk" "i_sys_clk";
|
||||||
BLOCK RESETPATHS ;
|
BLOCK RESETPATHS ;
|
||||||
BLOCK ASYNCPATHS ;
|
BLOCK ASYNCPATHS ;
|
||||||
LOCATE COMP "i_sys_clk" SITE "B9" ;
|
LOCATE COMP "i_sys_clk" SITE "B9" ;
|
||||||
@@ -11,12 +12,12 @@ LOCATE COMP "i_rst_n" SITE "Y14" ;
|
|||||||
LOCATE COMP "i_sclk" SITE "AA16" ;
|
LOCATE COMP "i_sclk" SITE "AA16" ;
|
||||||
LOCATE COMP "i_cs" SITE "Y15" ;
|
LOCATE COMP "i_cs" SITE "Y15" ;
|
||||||
LOCATE COMP "i_mosi" SITE "AB12" ;
|
LOCATE COMP "i_mosi" SITE "AB12" ;
|
||||||
//LOCATE COMP "o_RC_T[26]" SITE "U13" ;
|
//LOCATE COMP "o_RC_T[26]" SITE "U13" ;
|
||||||
//LOCATE COMP "o_RC_T[27]" SITE "U12" ;
|
//LOCATE COMP "o_RC_T[27]" SITE "U12" ;
|
||||||
//LOCATE COMP "o_RC_T[28]" SITE "T12" ;
|
//LOCATE COMP "o_RC_T[28]" SITE "T12" ;
|
||||||
//LOCATE COMP "o_RC_T[29]" SITE "T11" ;
|
//LOCATE COMP "o_RC_T[29]" SITE "T11" ;
|
||||||
//LOCATE COMP "o_RC_T[30]" SITE "U11" ;
|
//LOCATE COMP "o_RC_T[30]" SITE "U11" ;
|
||||||
//LOCATE COMP "o_RC_T[31]" SITE "V11" ;
|
//LOCATE COMP "o_RC_T[31]" SITE "V11" ;
|
||||||
IOBUF PORT "i_cs" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "i_cs" IO_TYPE=LVCMOS33 ;
|
||||||
IOBUF PORT "i_mosi" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "i_mosi" IO_TYPE=LVCMOS33 ;
|
||||||
IOBUF PORT "i_rst_n" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "i_rst_n" IO_TYPE=LVCMOS33 ;
|
||||||
@@ -127,196 +128,197 @@ LOCATE COMP "o_RC_T[23]" SITE "U15" ;
|
|||||||
LOCATE COMP "o_RC_T[24]" SITE "T13" ;
|
LOCATE COMP "o_RC_T[24]" SITE "T13" ;
|
||||||
LOCATE COMP "o_RC_T[25]" SITE "AA13" ;
|
LOCATE COMP "o_RC_T[25]" SITE "AA13" ;
|
||||||
LOCATE COMP "o_err" SITE "AB16" ;
|
LOCATE COMP "o_err" SITE "AB16" ;
|
||||||
IOBUF PORT "o_OC_1[0]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[0]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[16]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[16]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_1[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[0]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[0]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[16]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[16]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_2[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_2[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[0]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[0]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[16]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[16]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_3[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_3[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[0]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[0]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[1]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[2]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[3]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[4]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[5]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[6]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[7]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[9]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[10]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[11]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[12]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[13]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[14]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[15]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[16]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[16]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[17]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[18]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[19]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[20]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[21]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[22]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[23]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[24]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[25]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[26]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[27]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[28]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[29]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[30]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_4[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
IOBUF PORT "o_PMU_OC_4[31]" IO_TYPE=LVCMOS33 PULLMODE=NONE ;
|
||||||
IOBUF PORT "o_OC_1[8]" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "o_PMU_OC_1[8]" IO_TYPE=LVCMOS33 ;
|
||||||
IOBUF PORT "o_OC_2[8]" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "o_PMU_OC_2[8]" IO_TYPE=LVCMOS33 ;
|
||||||
IOBUF PORT "o_OC_3[8]" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "o_PMU_OC_3[8]" IO_TYPE=LVCMOS33 ;
|
||||||
IOBUF PORT "o_OC_4[8]" IO_TYPE=LVCMOS33 ;
|
IOBUF PORT "o_PMU_OC_4[8]" IO_TYPE=LVCMOS33 ;
|
||||||
LOCATE COMP "o_OC_1[8]" SITE "D14" ;
|
LOCATE COMP "o_PMU_OC_1[8]" SITE "D14" ;
|
||||||
LOCATE COMP "o_OC_1[9]" SITE "G13" ;
|
LOCATE COMP "o_PMU_OC_1[9]" SITE "G13" ;
|
||||||
LOCATE COMP "o_OC_1[10]" SITE "C13" ;
|
LOCATE COMP "o_PMU_OC_1[10]" SITE "C13" ;
|
||||||
LOCATE COMP "o_OC_1[11]" SITE "F13" ;
|
LOCATE COMP "o_PMU_OC_1[11]" SITE "F13" ;
|
||||||
LOCATE COMP "o_OC_1[12]" SITE "C17" ;
|
LOCATE COMP "o_PMU_OC_1[12]" SITE "C17" ;
|
||||||
LOCATE COMP "o_OC_1[13]" SITE "F17" ;
|
LOCATE COMP "o_PMU_OC_1[13]" SITE "F17" ;
|
||||||
LOCATE COMP "o_OC_1[14]" SITE "D17" ;
|
LOCATE COMP "o_PMU_OC_1[14]" SITE "D17" ;
|
||||||
LOCATE COMP "o_OC_1[15]" SITE "E17" ;
|
LOCATE COMP "o_PMU_OC_1[15]" SITE "E17" ;
|
||||||
LOCATE COMP "o_OC_1[24]" SITE "N5" ;
|
LOCATE COMP "o_PMU_OC_1[24]" SITE "N5" ;
|
||||||
LOCATE COMP "o_OC_1[25]" SITE "D15" ;
|
LOCATE COMP "o_PMU_OC_1[25]" SITE "D15" ;
|
||||||
LOCATE COMP "o_OC_1[26]" SITE "P3" ;
|
LOCATE COMP "o_PMU_OC_1[26]" SITE "P3" ;
|
||||||
LOCATE COMP "o_OC_1[27]" SITE "M4" ;
|
LOCATE COMP "o_PMU_OC_1[27]" SITE "M4" ;
|
||||||
LOCATE COMP "o_OC_1[28]" SITE "R6" ;
|
LOCATE COMP "o_PMU_OC_1[28]" SITE "R6" ;
|
||||||
LOCATE COMP "o_OC_1[29]" SITE "T5" ;
|
LOCATE COMP "o_PMU_OC_1[29]" SITE "T5" ;
|
||||||
LOCATE COMP "o_OC_1[30]" SITE "P6" ;
|
LOCATE COMP "o_PMU_OC_1[30]" SITE "P6" ;
|
||||||
LOCATE COMP "o_OC_1[31]" SITE "U4" ;
|
LOCATE COMP "o_PMU_OC_1[31]" SITE "U4" ;
|
||||||
LOCATE COMP "o_OC_2[8]" SITE "C1" ;
|
LOCATE COMP "o_PMU_OC_2[8]" SITE "C1" ;
|
||||||
LOCATE COMP "o_OC_2[9]" SITE "C2" ;
|
LOCATE COMP "o_PMU_OC_2[9]" SITE "C2" ;
|
||||||
LOCATE COMP "o_OC_2[10]" SITE "C3" ;
|
LOCATE COMP "o_PMU_OC_2[10]" SITE "C3" ;
|
||||||
LOCATE COMP "o_OC_2[11]" SITE "B1" ;
|
LOCATE COMP "o_PMU_OC_2[11]" SITE "B1" ;
|
||||||
LOCATE COMP "o_OC_2[12]" SITE "H5" ;
|
LOCATE COMP "o_PMU_OC_2[12]" SITE "H5" ;
|
||||||
LOCATE COMP "o_OC_2[13]" SITE "H6" ;
|
LOCATE COMP "o_PMU_OC_2[13]" SITE "H6" ;
|
||||||
LOCATE COMP "o_OC_2[14]" SITE "H2" ;
|
LOCATE COMP "o_PMU_OC_2[14]" SITE "H2" ;
|
||||||
LOCATE COMP "o_OC_2[15]" SITE "H3" ;
|
LOCATE COMP "o_PMU_OC_2[15]" SITE "H3" ;
|
||||||
LOCATE COMP "o_OC_2[24]" SITE "T7" ;
|
LOCATE COMP "o_PMU_OC_2[24]" SITE "T7" ;
|
||||||
LOCATE COMP "o_OC_2[25]" SITE "U5" ;
|
LOCATE COMP "o_PMU_OC_2[25]" SITE "U5" ;
|
||||||
LOCATE COMP "o_OC_2[26]" SITE "W5" ;
|
LOCATE COMP "o_PMU_OC_2[26]" SITE "W5" ;
|
||||||
LOCATE COMP "o_OC_2[27]" SITE "T6" ;
|
LOCATE COMP "o_PMU_OC_2[27]" SITE "T6" ;
|
||||||
LOCATE COMP "o_OC_2[28]" SITE "E8" ;
|
LOCATE COMP "o_PMU_OC_2[28]" SITE "E8" ;
|
||||||
LOCATE COMP "o_OC_2[29]" SITE "E9" ;
|
LOCATE COMP "o_PMU_OC_2[29]" SITE "E9" ;
|
||||||
LOCATE COMP "o_OC_2[30]" SITE "E10" ;
|
LOCATE COMP "o_PMU_OC_2[30]" SITE "E10" ;
|
||||||
LOCATE COMP "o_OC_2[31]" SITE "D11" ;
|
LOCATE COMP "o_PMU_OC_2[31]" SITE "D11" ;
|
||||||
LOCATE COMP "o_OC_3[8]" SITE "A11" ;
|
LOCATE COMP "o_PMU_OC_3[8]" SITE "A11" ;
|
||||||
LOCATE COMP "o_OC_3[9]" SITE "A12" ;
|
LOCATE COMP "o_PMU_OC_3[9]" SITE "A12" ;
|
||||||
LOCATE COMP "o_OC_3[10]" SITE "B12" ;
|
LOCATE COMP "o_PMU_OC_3[10]" SITE "B12" ;
|
||||||
LOCATE COMP "o_OC_3[11]" SITE "A13" ;
|
LOCATE COMP "o_PMU_OC_3[11]" SITE "A13" ;
|
||||||
LOCATE COMP "o_OC_3[12]" SITE "B19" ;
|
LOCATE COMP "o_PMU_OC_3[12]" SITE "B19" ;
|
||||||
LOCATE COMP "o_OC_3[13]" SITE "C18" ;
|
LOCATE COMP "o_PMU_OC_3[13]" SITE "C18" ;
|
||||||
LOCATE COMP "o_OC_3[14]" SITE "A17" ;
|
LOCATE COMP "o_PMU_OC_3[14]" SITE "A17" ;
|
||||||
LOCATE COMP "o_OC_3[15]" SITE "B16" ;
|
LOCATE COMP "o_PMU_OC_3[15]" SITE "B16" ;
|
||||||
LOCATE COMP "o_OC_3[24]" SITE "B13" ;
|
LOCATE COMP "o_PMU_OC_3[24]" SITE "B13" ;
|
||||||
LOCATE COMP "o_OC_3[25]" SITE "B14" ;
|
LOCATE COMP "o_PMU_OC_3[25]" SITE "B14" ;
|
||||||
LOCATE COMP "o_OC_3[26]" SITE "B15" ;
|
LOCATE COMP "o_PMU_OC_3[26]" SITE "B15" ;
|
||||||
LOCATE COMP "o_OC_3[27]" SITE "C15" ;
|
LOCATE COMP "o_PMU_OC_3[27]" SITE "C15" ;
|
||||||
LOCATE COMP "o_OC_3[28]" SITE "G21" ;
|
LOCATE COMP "o_PMU_OC_3[28]" SITE "G21" ;
|
||||||
LOCATE COMP "o_OC_3[29]" SITE "E22" ;
|
LOCATE COMP "o_PMU_OC_3[29]" SITE "E22" ;
|
||||||
LOCATE COMP "o_OC_3[30]" SITE "E20" ;
|
LOCATE COMP "o_PMU_OC_3[30]" SITE "E20" ;
|
||||||
LOCATE COMP "o_OC_3[31]" SITE "D21" ;
|
LOCATE COMP "o_PMU_OC_3[31]" SITE "D21" ;
|
||||||
LOCATE COMP "o_OC_4[8]" SITE "G1" ;
|
LOCATE COMP "o_PMU_OC_4[8]" SITE "G1" ;
|
||||||
LOCATE COMP "o_OC_4[9]" SITE "G2" ;
|
LOCATE COMP "o_PMU_OC_4[9]" SITE "G2" ;
|
||||||
LOCATE COMP "o_OC_4[10]" SITE "G3" ;
|
LOCATE COMP "o_PMU_OC_4[10]" SITE "G3" ;
|
||||||
LOCATE COMP "o_OC_4[11]" SITE "F1" ;
|
LOCATE COMP "o_PMU_OC_4[11]" SITE "F1" ;
|
||||||
LOCATE COMP "o_OC_4[12]" SITE "C4" ;
|
LOCATE COMP "o_PMU_OC_4[12]" SITE "C4" ;
|
||||||
LOCATE COMP "o_OC_4[13]" SITE "C5" ;
|
LOCATE COMP "o_PMU_OC_4[13]" SITE "C5" ;
|
||||||
LOCATE COMP "o_OC_4[14]" SITE "G11" ;
|
LOCATE COMP "o_PMU_OC_4[14]" SITE "G11" ;
|
||||||
LOCATE COMP "o_OC_4[15]" SITE "E11" ;
|
LOCATE COMP "o_PMU_OC_4[15]" SITE "E11" ;
|
||||||
LOCATE COMP "o_OC_4[24]" SITE "E1" ;
|
LOCATE COMP "o_PMU_OC_4[24]" SITE "E1" ;
|
||||||
LOCATE COMP "o_OC_4[25]" SITE "D1" ;
|
LOCATE COMP "o_PMU_OC_4[25]" SITE "D1" ;
|
||||||
LOCATE COMP "o_OC_4[26]" SITE "E2" ;
|
LOCATE COMP "o_PMU_OC_4[26]" SITE "E2" ;
|
||||||
LOCATE COMP "o_OC_4[27]" SITE "D3" ;
|
LOCATE COMP "o_PMU_OC_4[27]" SITE "D3" ;
|
||||||
LOCATE COMP "o_OC_4[28]" SITE "C11" ;
|
LOCATE COMP "o_PMU_OC_4[28]" SITE "C11" ;
|
||||||
LOCATE COMP "o_OC_4[29]" SITE "A2" ;
|
LOCATE COMP "o_PMU_OC_4[29]" SITE "A2" ;
|
||||||
LOCATE COMP "o_OC_4[30]" SITE "B3" ;
|
LOCATE COMP "o_PMU_OC_4[30]" SITE "B3" ;
|
||||||
LOCATE COMP "o_OC_4[31]" SITE "A3" ;
|
LOCATE COMP "o_PMU_OC_4[31]" SITE "A3" ;
|
||||||
USE PRIMARY NET "i_sys_clk_c" ;
|
USE PRIMARY NET "i_sys_clk_c" ;
|
||||||
|
IOBUF PORT "o_rvalid" IO_TYPE=LVCMOS33 ;
|
||||||
|
|||||||
+13
-2
@@ -21,13 +21,19 @@ module Reg_file (
|
|||||||
output [23:0] o_freq1,
|
output [23:0] o_freq1,
|
||||||
output [23:0] o_freq2,
|
output [23:0] o_freq2,
|
||||||
output [23:0] o_freq3,
|
output [23:0] o_freq3,
|
||||||
output [23:0] o_freq4
|
output [23:0] o_freq4,
|
||||||
|
|
||||||
|
//DC Regs
|
||||||
|
output [23:0] o_DC1,
|
||||||
|
output [23:0] o_DC2,
|
||||||
|
output [23:0] o_DC3,
|
||||||
|
output [23:0] o_DC4
|
||||||
);
|
);
|
||||||
|
|
||||||
// --- Parameters ---
|
// --- Parameters ---
|
||||||
localparam REG_COUNT = 16;
|
localparam REG_COUNT = 16;
|
||||||
localparam [23:0]
|
localparam [23:0]
|
||||||
IDENT = 24'h400000|| 12'b0001_0000_0000, //CPLD2==1,version=1.0.0
|
IDENT = 24'h400000 | 12'b0001_0001_0000, //CPLD2==1,version=1.1.0
|
||||||
STATE_INIT = 24'h800000;
|
STATE_INIT = 24'h800000;
|
||||||
|
|
||||||
// State Machine Definition
|
// State Machine Definition
|
||||||
@@ -163,5 +169,10 @@ module Reg_file (
|
|||||||
assign o_freq2 = regtable[3];
|
assign o_freq2 = regtable[3];
|
||||||
assign o_freq3 = regtable[4];
|
assign o_freq3 = regtable[4];
|
||||||
assign o_freq4 = regtable[5];
|
assign o_freq4 = regtable[5];
|
||||||
|
|
||||||
|
assign o_DC1 = regtable[6];
|
||||||
|
assign o_DC2 = regtable[7];
|
||||||
|
assign o_DC3 = regtable[8];
|
||||||
|
assign o_DC4 = regtable[9];
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
+66
-17
@@ -8,7 +8,7 @@ module RelayConTop (
|
|||||||
output o_miso,
|
output o_miso,
|
||||||
output o_rvalid,
|
output o_rvalid,
|
||||||
input i_rready,
|
input i_rready,
|
||||||
input i_wvaild,
|
input i_wvalid,
|
||||||
output o_wready,
|
output o_wready,
|
||||||
output o_err,
|
output o_err,
|
||||||
output [7:0]o_RC_F, //Ref: Schematic
|
output [7:0]o_RC_F, //Ref: Schematic
|
||||||
@@ -16,10 +16,10 @@ module RelayConTop (
|
|||||||
output [25:0]o_RC_T, //Actually ONLY 25 pin(rest is on CPLD1)
|
output [25:0]o_RC_T, //Actually ONLY 25 pin(rest is on CPLD1)
|
||||||
//output [3:0] o_OC_x09,
|
//output [3:0] o_OC_x09,
|
||||||
//output [3:0] o_OC_x25,
|
//output [3:0] o_OC_x25,
|
||||||
output [31:0]o_OC_1,
|
output [31:0]o_PMU_OC_1 ,
|
||||||
output [31:0]o_OC_2,
|
output [31:0]o_PMU_OC_2 ,
|
||||||
output [31:0]o_OC_3,
|
output [31:0]o_PMU_OC_3 ,
|
||||||
output [31:0]o_OC_4
|
output [31:0]o_PMU_OC_4
|
||||||
);
|
);
|
||||||
|
|
||||||
wire [7:0] RC_F;
|
wire [7:0] RC_F;
|
||||||
@@ -37,30 +37,44 @@ module RelayConTop (
|
|||||||
wire wr_flag; //1=write,0=read
|
wire wr_flag; //1=write,0=read
|
||||||
wire bus_err_flag;
|
wire bus_err_flag;
|
||||||
wire reg_err_flag;
|
wire reg_err_flag;
|
||||||
|
wire cpld_err_flag;
|
||||||
|
|
||||||
wire con_exec;
|
wire con_exec;
|
||||||
wire [23:0]freq1_relay ;
|
wire [23:0]freq1_relay ;
|
||||||
wire [23:0]freq2_relay ;
|
wire [23:0]freq2_relay ;
|
||||||
wire [23:0]freq3_relay ;
|
wire [23:0]freq3_relay ;
|
||||||
wire [23:0]freq4_relay ;
|
wire [23:0]freq4_relay ;
|
||||||
|
|
||||||
|
//DC Control Reg output
|
||||||
|
wire [23:0]DC_Con1 ;
|
||||||
|
wire [23:0]DC_Con2 ;
|
||||||
|
wire [23:0]DC_Con3 ;
|
||||||
|
wire [23:0]DC_Con4 ;
|
||||||
|
|
||||||
|
//PMU OC Control
|
||||||
|
wire [31:0]PMU_OC_1 ;
|
||||||
|
wire [31:0]PMU_OC_2 ;
|
||||||
|
wire [31:0]PMU_OC_3 ;
|
||||||
|
wire [31:0]PMU_OC_4 ;
|
||||||
|
|
||||||
wire con_rvalid;
|
wire con_rvalid;
|
||||||
|
|
||||||
wire con_done;
|
wire con_done;
|
||||||
|
|
||||||
BUS_Con BUS_Con_2(
|
BUS_Con BUS_Con_2(
|
||||||
.i_sys_clk(i_sys_clk),
|
.i_sys_clk(i_sys_clk),
|
||||||
.i_rst_n(i_rst_n),
|
.i_rst_n(i_rst_n),
|
||||||
.i_sclk(i_sclk),
|
.i_sclk(i_sclk),
|
||||||
.i_mosi(i_mosi),
|
.i_mosi(i_mosi),
|
||||||
.i_cs(i_cs),
|
.i_cs(i_cs),
|
||||||
.i_rvaild(con_rvaild),
|
.i_rvalid(con_rvalid),
|
||||||
.i_wvaild(i_wvaild),
|
.i_wvalid(i_wvalid),
|
||||||
.i_reg_busy(reg_busy),
|
.i_reg_busy(reg_busy),
|
||||||
.i_rdata(r_data),
|
.i_rdata(r_data),
|
||||||
.o_cmd_vaild(cmd_valid),
|
.o_cmd_valid(cmd_valid),
|
||||||
.o_wr(wr_flag),
|
.o_wr(wr_flag),
|
||||||
.o_miso(o_miso),
|
.o_miso(o_miso),
|
||||||
.o_rvaild(o_rvalid),
|
.o_rvalid(o_rvalid),
|
||||||
.o_wready(o_wready),
|
.o_wready(o_wready),
|
||||||
.o_data(w_data),
|
.o_data(w_data),
|
||||||
.o_addr(reg_addr),
|
.o_addr(reg_addr),
|
||||||
@@ -79,6 +93,10 @@ module RelayConTop (
|
|||||||
.o_freq2(freq2_relay), //Freq_Slot2
|
.o_freq2(freq2_relay), //Freq_Slot2
|
||||||
.o_freq3(freq3_relay), //Freq_Slot3
|
.o_freq3(freq3_relay), //Freq_Slot3
|
||||||
.o_freq4(freq4_relay), //Freq_Slot4
|
.o_freq4(freq4_relay), //Freq_Slot4
|
||||||
|
.o_DC1(DC_Con1),
|
||||||
|
.o_DC2(DC_Con2),
|
||||||
|
.o_DC3(DC_Con3),
|
||||||
|
.o_DC4(DC_Con4),
|
||||||
.o_rvalid(con_rvalid),
|
.o_rvalid(con_rvalid),
|
||||||
.o_rdata(r_data),
|
.o_rdata(r_data),
|
||||||
.o_exec(con_exec), //Exec cmd
|
.o_exec(con_exec), //Exec cmd
|
||||||
@@ -94,12 +112,21 @@ module RelayConTop (
|
|||||||
.i_freq_relay2(freq2_relay),
|
.i_freq_relay2(freq2_relay),
|
||||||
.i_freq_relay3(freq3_relay),
|
.i_freq_relay3(freq3_relay),
|
||||||
.i_freq_relay4(freq4_relay),
|
.i_freq_relay4(freq4_relay),
|
||||||
|
.i_DC_Con1(DC_Con1),
|
||||||
|
.i_DC_Con2(DC_Con2),
|
||||||
|
.i_DC_Con3(DC_Con3),
|
||||||
|
.i_DC_Con4(DC_Con4),
|
||||||
|
.o_PMU_OC_1(PMU_OC_1),
|
||||||
|
.o_PMU_OC_2(PMU_OC_2),
|
||||||
|
.o_PMU_OC_3(PMU_OC_3),
|
||||||
|
.o_PMU_OC_4(PMU_OC_4),
|
||||||
.o_con_done(con_done),
|
.o_con_done(con_done),
|
||||||
.o_RC_F(RC_F),
|
.o_RC_F(RC_F),
|
||||||
.o_RC_S(RC_S),
|
.o_RC_S(RC_S),
|
||||||
.o_RC_T(RC_T),
|
.o_RC_T(RC_T),
|
||||||
.o_OC_x09(OC_x09),
|
.o_OC_x09(OC_x09),
|
||||||
.o_OC_x25(OC_x25)
|
.o_OC_x25(OC_x25),
|
||||||
|
.o_err(cpld_err_flag)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -107,12 +134,34 @@ module RelayConTop (
|
|||||||
assign o_RC_S = RC_S;
|
assign o_RC_S = RC_S;
|
||||||
assign o_RC_T = RC_T[25:0];
|
assign o_RC_T = RC_T[25:0];
|
||||||
|
|
||||||
//assign o_OC_1[8] = OC_x09[0];
|
assign o_PMU_OC_1[8] = OC_x09[0];
|
||||||
//assign o_OC_2[8] = OC_x09[1];
|
assign o_PMU_OC_2[8] = OC_x09[1];
|
||||||
//assign o_OC_3[8] = OC_x09[2];
|
assign o_PMU_OC_3[8] = OC_x09[2];
|
||||||
//assign o_OC_4[8] = OC_x09[3];
|
assign o_PMU_OC_4[8] = OC_x09[3];
|
||||||
|
|
||||||
assign o_err = bus_err_flag || reg_err_flag;
|
assign o_PMU_OC_1[24] = OC_x25[0];
|
||||||
|
assign o_PMU_OC_2[24] = OC_x25[1];
|
||||||
|
assign o_PMU_OC_3[24] = OC_x25[2];
|
||||||
|
assign o_PMU_OC_4[24] = OC_x25[3];
|
||||||
|
|
||||||
|
assign o_PMU_OC_1[7:0] = PMU_OC_1[7:0];
|
||||||
|
assign o_PMU_OC_1[23:9] = PMU_OC_1[23:8];
|
||||||
|
assign o_PMU_OC_1[31:25] = PMU_OC_1[31:25];
|
||||||
|
|
||||||
|
assign o_PMU_OC_2[7:0] = PMU_OC_2[7:0];
|
||||||
|
assign o_PMU_OC_2[23:9] = PMU_OC_2[23:9];
|
||||||
|
assign o_PMU_OC_2[31:25] = PMU_OC_2[31:25];
|
||||||
|
|
||||||
|
assign o_PMU_OC_3[7:0] = PMU_OC_3[7:0];
|
||||||
|
assign o_PMU_OC_3[23:9] = PMU_OC_3[23:9];
|
||||||
|
assign o_PMU_OC_3[31:25]= PMU_OC_3[31:25];
|
||||||
|
|
||||||
|
assign o_PMU_OC_4[7:0] = PMU_OC_4[7:0];
|
||||||
|
assign o_PMU_OC_4[23:9] = PMU_OC_4[23:9];
|
||||||
|
assign o_PMU_OC_4[31:25] = PMU_OC_4[31:25];
|
||||||
|
|
||||||
|
|
||||||
|
assign o_err = bus_err_flag || reg_err_flag || cpld_err_flag;
|
||||||
|
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|||||||
+924
-270
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,3 @@
|
|||||||
[General]
|
[General]
|
||||||
Export.auto_tasks=Bitgen, Jedecgen
|
Export.auto_tasks=Bitgen, Jedecgen
|
||||||
|
Map.auto_tasks=MapTrace
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ pin_sort_type=0
|
|||||||
pin_sort_ascending=true
|
pin_sort_ascending=true
|
||||||
sig_sort_type=0
|
sig_sort_type=0
|
||||||
sig_sort_ascending=true
|
sig_sort_ascending=true
|
||||||
active_Sheet=Pin Assignments
|
active_Sheet=Port Assignments
|
||||||
|
|
||||||
[Port%20Assignments]
|
[Port%20Assignments]
|
||||||
Name="193,0"
|
Name="193,0"
|
||||||
|
|||||||
+79
-21
@@ -6,6 +6,13 @@ module CPLD_Con (
|
|||||||
input [23:0]i_freq_relay2,
|
input [23:0]i_freq_relay2,
|
||||||
input [23:0]i_freq_relay3,
|
input [23:0]i_freq_relay3,
|
||||||
input [23:0]i_freq_relay4,
|
input [23:0]i_freq_relay4,
|
||||||
|
|
||||||
|
// DC related Control
|
||||||
|
input [23:0]i_DC_Con1,
|
||||||
|
input [23:0]i_DC_Con2,
|
||||||
|
input [23:0]i_DC_Con3,
|
||||||
|
input [23:0]i_DC_Con4,
|
||||||
|
|
||||||
output o_con_done,
|
output o_con_done,
|
||||||
output [3:0]o_PMU_RC,
|
output [3:0]o_PMU_RC,
|
||||||
output o_err
|
output o_err
|
||||||
@@ -14,10 +21,16 @@ module CPLD_Con (
|
|||||||
//Relay Reg
|
//Relay Reg
|
||||||
reg [3:0] PMU_RC;
|
reg [3:0] PMU_RC;
|
||||||
|
|
||||||
|
//Condition Tester
|
||||||
|
reg [15:0]en_t ;
|
||||||
|
reg freq_t;
|
||||||
|
reg dc_t;
|
||||||
|
|
||||||
//Flags
|
//Flags
|
||||||
reg exec_flag;
|
reg exec_flag;
|
||||||
reg err_flag;
|
reg err_flag;
|
||||||
reg [3:0]slot_exec_flag;
|
reg [3:0]freq_slot_flag;
|
||||||
|
reg [3:0]dc_slot_flag;
|
||||||
reg done_flag;
|
reg done_flag;
|
||||||
|
|
||||||
//Counter
|
//Counter
|
||||||
@@ -37,11 +50,27 @@ module CPLD_Con (
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
//Function Identify
|
||||||
|
always @(posedge i_sys_clk) begin
|
||||||
|
if (i_rst_n == 1'b0) begin
|
||||||
|
en_t <= 'd0;
|
||||||
|
freq_t <= 'd0;
|
||||||
|
dc_t <= 'd0;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
en_t <= (i_freq_relay1[0] + i_freq_relay2[0] + i_freq_relay3[0] + i_freq_relay4[0]) + (i_DC_Con1[0] +i_DC_Con2[0] +i_DC_Con3[0] +i_DC_Con4[0] );
|
||||||
|
freq_t <= i_freq_relay1[0] + i_freq_relay2[0] + i_freq_relay3[0] + i_freq_relay4[0];
|
||||||
|
dc_t <= i_DC_Con1[0] +i_DC_Con2[0] +i_DC_Con3[0] +i_DC_Con4[0];
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
// Main Controller Function
|
||||||
always @(posedge i_sys_clk) begin
|
always @(posedge i_sys_clk) begin
|
||||||
if (i_rst_n == 1'b0) begin
|
if (i_rst_n == 1'b0) begin
|
||||||
exec_flag <= 1'b0;
|
exec_flag <= 1'b0;
|
||||||
err_flag <= 1'b0;
|
err_flag <= 1'b0;
|
||||||
slot_exec_flag <= 'd0;
|
freq_slot_flag <= 'd0;
|
||||||
|
dc_slot_flag<='d0;
|
||||||
done_flag <= 'd1;
|
done_flag <= 'd1;
|
||||||
PMU_RC <= 4'b1111;
|
PMU_RC <= 4'b1111;
|
||||||
end
|
end
|
||||||
@@ -50,31 +79,60 @@ module CPLD_Con (
|
|||||||
exec_flag <= 1'b1;
|
exec_flag <= 1'b1;
|
||||||
done_flag <= 1'b0;
|
done_flag <= 1'b0;
|
||||||
//To DO: More Sanity Check?
|
//To DO: More Sanity Check?
|
||||||
if ( (i_freq_relay1[0] + i_freq_relay2[0] + i_freq_relay3[0] + i_freq_relay4[0]) > 2'd1 ) begin
|
if (en_t > 'd1) begin //Only ONE Enable bit should be set!
|
||||||
err_flag <= 1'b1;
|
err_flag <= 1'b1;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
slot_exec_flag[0] <= i_freq_relay1[0];
|
freq_slot_flag[0] <= i_freq_relay1[0];
|
||||||
slot_exec_flag[1] <= i_freq_relay2[0];
|
freq_slot_flag[1] <= i_freq_relay2[0];
|
||||||
slot_exec_flag[2] <= i_freq_relay3[0];
|
freq_slot_flag[2] <= i_freq_relay3[0];
|
||||||
slot_exec_flag[3] <= i_freq_relay4[0];
|
freq_slot_flag[3] <= i_freq_relay4[0];
|
||||||
|
|
||||||
|
dc_slot_flag[0] <= i_DC_Con1[0];
|
||||||
|
dc_slot_flag[1] <= i_DC_Con2[0];
|
||||||
|
dc_slot_flag[2] <= i_DC_Con3[0];
|
||||||
|
dc_slot_flag[3] <= i_DC_Con4[0];
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else if (exec_flag == 1'b1) begin
|
else if (exec_flag == 1'b1) begin
|
||||||
case (slot_exec_flag)
|
if (freq_t == 1'b1) begin
|
||||||
4'b0001: begin
|
case (freq_slot_flag)
|
||||||
PMU_RC <= 4'b1111;
|
4'b0001: begin
|
||||||
end
|
PMU_RC <= 4'b1111;
|
||||||
4'b0010: begin
|
end
|
||||||
PMU_RC <= 4'b1100;
|
4'b0010: begin
|
||||||
end
|
PMU_RC <= 4'b1100;
|
||||||
4'b0100: begin
|
end
|
||||||
PMU_RC <= 4'b1010;
|
4'b0100: begin
|
||||||
end
|
PMU_RC <= 4'b1010;
|
||||||
4'b1000: begin
|
end
|
||||||
PMU_RC <= 4'b0110;
|
4'b1000: begin
|
||||||
end
|
PMU_RC <= 4'b0110;
|
||||||
endcase
|
end
|
||||||
|
default:begin
|
||||||
|
PMU_RC <= 4'b0000;
|
||||||
|
end
|
||||||
|
endcase
|
||||||
|
end
|
||||||
|
else if (dc_t == 1'b1) begin
|
||||||
|
case (dc_slot_flag)
|
||||||
|
4'b0001: begin
|
||||||
|
PMU_RC <= 4'b0001;
|
||||||
|
end
|
||||||
|
4'b0010: begin
|
||||||
|
PMU_RC <= 4'b0010;
|
||||||
|
end
|
||||||
|
4'b0100: begin
|
||||||
|
PMU_RC <= 4'b0100;
|
||||||
|
end
|
||||||
|
4'b1000: begin
|
||||||
|
PMU_RC <= 4'b1000;
|
||||||
|
end
|
||||||
|
default:begin
|
||||||
|
PMU_RC <= 4'b0000;
|
||||||
|
end
|
||||||
|
endcase
|
||||||
|
end
|
||||||
done_flag <= 1'b1;
|
done_flag <= 1'b1;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+16
-3
@@ -21,13 +21,19 @@ module Reg_file (
|
|||||||
output [23:0] o_freq1,
|
output [23:0] o_freq1,
|
||||||
output [23:0] o_freq2,
|
output [23:0] o_freq2,
|
||||||
output [23:0] o_freq3,
|
output [23:0] o_freq3,
|
||||||
output [23:0] o_freq4
|
output [23:0] o_freq4,
|
||||||
|
|
||||||
|
//DC Regs
|
||||||
|
output [23:0] o_DC1,
|
||||||
|
output [23:0] o_DC2,
|
||||||
|
output [23:0] o_DC3,
|
||||||
|
output [23:0] o_DC4
|
||||||
);
|
);
|
||||||
|
|
||||||
// --- Parameters ---
|
// --- Parameters ---
|
||||||
localparam REG_COUNT = 16;
|
localparam REG_COUNT = 16;
|
||||||
localparam [23:0]
|
localparam [23:0]
|
||||||
IDENT = 24'h800000|| 12'b0001_0000_0000, //CPLD3==1,version=1.0.0
|
IDENT = 24'h800000 | 12'b0001_0000_0000, //CPLD3==1,version=1.0.0
|
||||||
STATE_INIT = 24'h800000;
|
STATE_INIT = 24'h800000;
|
||||||
|
|
||||||
// State Machine Definition
|
// State Machine Definition
|
||||||
@@ -125,7 +131,9 @@ module Reg_file (
|
|||||||
// Wait for Controller to register the command and pull 'done' LOW (Busy)
|
// Wait for Controller to register the command and pull 'done' LOW (Busy)
|
||||||
EXEC_ACK: begin
|
EXEC_ACK: begin
|
||||||
busy_flag <= 1'b1;
|
busy_flag <= 1'b1;
|
||||||
state <= EXEC_WAIT;
|
if (i_con_done == 1'b0) begin
|
||||||
|
state <= EXEC_WAIT;
|
||||||
|
end
|
||||||
// Optional: Timeout counter here to prevent hanging if Controller is dead
|
// Optional: Timeout counter here to prevent hanging if Controller is dead
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -162,4 +170,9 @@ module Reg_file (
|
|||||||
assign o_freq3 = regtable[4];
|
assign o_freq3 = regtable[4];
|
||||||
assign o_freq4 = regtable[5];
|
assign o_freq4 = regtable[5];
|
||||||
|
|
||||||
|
assign o_DC1 = regtable[6];
|
||||||
|
assign o_DC2 = regtable[7];
|
||||||
|
assign o_DC3 = regtable[8];
|
||||||
|
assign o_DC4 = regtable[9];
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
@@ -6,23 +6,24 @@ module RelayConTop (
|
|||||||
input i_mosi,
|
input i_mosi,
|
||||||
input i_cs,
|
input i_cs,
|
||||||
output o_miso,
|
output o_miso,
|
||||||
output o_rvaild,
|
output o_rvalid,
|
||||||
input i_rready,
|
input i_rready,
|
||||||
input i_wvaild,
|
input i_wvaild,
|
||||||
|
|
||||||
|
output [3:0]o_PMU_RC,
|
||||||
|
|
||||||
output o_wready,
|
output o_wready,
|
||||||
output o_err,
|
output o_err,
|
||||||
output o_con_done,
|
output o_con_done
|
||||||
output [3:0]o_PMU_RC
|
|
||||||
);
|
);
|
||||||
|
|
||||||
wire [3:0]PMU_RC ;
|
wire [3:0]PMU_RC ;
|
||||||
|
|
||||||
|
|
||||||
wire [23:0]r_data ;
|
wire [23:0]r_data ;
|
||||||
wire [23:0]w_data ;
|
wire [23:0]w_data ;
|
||||||
wire [6:0]reg_addr ;
|
wire [6:0]reg_addr ;
|
||||||
|
|
||||||
wire cmd_vaild;
|
wire cmd_valid;
|
||||||
wire reg_busy;
|
wire reg_busy;
|
||||||
wire wr_flag; //1=write,0=read
|
wire wr_flag; //1=write,0=read
|
||||||
wire bus_err_flag;
|
wire bus_err_flag;
|
||||||
@@ -34,8 +35,14 @@ module RelayConTop (
|
|||||||
wire [23:0]freq2_relay ;
|
wire [23:0]freq2_relay ;
|
||||||
wire [23:0]freq3_relay ;
|
wire [23:0]freq3_relay ;
|
||||||
wire [23:0]freq4_relay ;
|
wire [23:0]freq4_relay ;
|
||||||
wire con_rvaild;
|
|
||||||
|
|
||||||
|
//DC Control Reg output
|
||||||
|
wire [23:0]DC_Con1 ;
|
||||||
|
wire [23:0]DC_Con2 ;
|
||||||
|
wire [23:0]DC_Con3 ;
|
||||||
|
wire [23:0]DC_Con4 ;
|
||||||
|
|
||||||
|
wire con_rvaild;
|
||||||
wire con_done;
|
wire con_done;
|
||||||
|
|
||||||
BUS_Con Bus_Con_3(
|
BUS_Con Bus_Con_3(
|
||||||
@@ -48,7 +55,7 @@ module RelayConTop (
|
|||||||
.i_wvalid(i_wvalid),
|
.i_wvalid(i_wvalid),
|
||||||
.i_reg_busy(reg_busy),
|
.i_reg_busy(reg_busy),
|
||||||
.i_rdata(r_data),
|
.i_rdata(r_data),
|
||||||
.o_cmd_valid(cmd_vaild),
|
.o_cmd_valid(cmd_valid),
|
||||||
.o_wr(wr_flag),
|
.o_wr(wr_flag),
|
||||||
.o_miso(o_miso),
|
.o_miso(o_miso),
|
||||||
.o_rvalid(o_rvalid),
|
.o_rvalid(o_rvalid),
|
||||||
@@ -61,7 +68,7 @@ module RelayConTop (
|
|||||||
Reg_file CPLD_Reg_3(
|
Reg_file CPLD_Reg_3(
|
||||||
.i_sys_clk(i_sys_clk),
|
.i_sys_clk(i_sys_clk),
|
||||||
.i_rst_n(i_rst_n),
|
.i_rst_n(i_rst_n),
|
||||||
.i_wr_req(cmd_vaild),
|
.i_wr_req(cmd_valid),
|
||||||
.i_wr(wr_flag),
|
.i_wr(wr_flag),
|
||||||
.i_addr(reg_addr),
|
.i_addr(reg_addr),
|
||||||
.i_wdata(w_data),
|
.i_wdata(w_data),
|
||||||
@@ -70,6 +77,10 @@ module RelayConTop (
|
|||||||
.o_freq2(freq2_relay), //Freq_Slot2
|
.o_freq2(freq2_relay), //Freq_Slot2
|
||||||
.o_freq3(freq3_relay), //Freq_Slot3
|
.o_freq3(freq3_relay), //Freq_Slot3
|
||||||
.o_freq4(freq4_relay), //Freq_Slot4
|
.o_freq4(freq4_relay), //Freq_Slot4
|
||||||
|
.o_DC1(DC_Con1),
|
||||||
|
.o_DC2(DC_Con2),
|
||||||
|
.o_DC3(DC_Con3),
|
||||||
|
.o_DC4(DC_Con4),
|
||||||
.o_rvalid(con_rvalid),
|
.o_rvalid(con_rvalid),
|
||||||
.o_rdata(r_data),
|
.o_rdata(r_data),
|
||||||
.o_exec(con_exec), //Exec cmd
|
.o_exec(con_exec), //Exec cmd
|
||||||
@@ -81,6 +92,10 @@ module RelayConTop (
|
|||||||
.i_sys_clk(i_sys_clk),
|
.i_sys_clk(i_sys_clk),
|
||||||
.i_rst_n(i_rst_n),
|
.i_rst_n(i_rst_n),
|
||||||
.i_con_exec(con_exec),
|
.i_con_exec(con_exec),
|
||||||
|
.i_DC_Con1(DC_Con1),
|
||||||
|
.i_DC_Con2(DC_Con2),
|
||||||
|
.i_DC_Con3(DC_Con3),
|
||||||
|
.i_DC_Con4(DC_Con4),
|
||||||
.i_freq_relay1(freq1_relay),
|
.i_freq_relay1(freq1_relay),
|
||||||
.i_freq_relay2(freq2_relay),
|
.i_freq_relay2(freq2_relay),
|
||||||
.i_freq_relay3(freq3_relay),
|
.i_freq_relay3(freq3_relay),
|
||||||
|
|||||||
+799
-270
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
|||||||
|
timestamp=[2026-05-26 10:20:53], mode=WORKBENCH_START, duration=0:00:02.125, duration_ms=2125, data={}
|
||||||
|
timestamp=[2026-05-26 10:20:53], mode=PLATFORM_REPOSITORY_INIT, duration=0:00:00.015, duration_ms=15, data={}
|
||||||
|
timestamp=[2026-05-26 10:20:53], mode=WORKBENCH_UI_INIT, duration=0:00:00.173, duration_ms=173, data={editors_count=0, platform_editors_count=0, projects_count=0, platform_projects_count=0, active_platform_editor=false, projects=}
|
||||||
|
timestamp=[2026-05-26 10:22:06], mode=PLATFORM_CREATION, duration=0:00:03.275, duration_ms=3275, data={platform_source=dsa, os=standalone, processor=ps7_cortexa9, platform=null}
|
||||||
|
timestamp=[2026-05-26 10:23:03], mode=APP_CREATION, duration=0:00:02.818, duration_ms=2818, data={name=NewInstrCalBoard, project_type=sdk, os=standalone, processor=cortex-a9, runtime=C/C++, platform=NewInstCal_bsp, application_type=application}
|
||||||
|
timestamp=[2026-05-26 10:24:48], mode=PLATFORM_GENERATION, duration=0:00:08.086, duration_ms=8086, data={name=NewInstCal_bsp}
|
||||||
|
timestamp=[2026-05-26 10:24:49], mode=BUILD, duration=0:00:00.432, duration_ms=432, data={name=NewInstrCalBoard, configuration=Debug, clean_build=false}
|
||||||
|
timestamp=[2026-05-26 10:31:30], mode=BUILD, duration=0:00:00.283, duration_ms=283, data={name=NewInstrCalBoard, configuration=Debug, clean_build=false}
|
||||||
|
timestamp=[2026-05-26 10:31:35], mode=BUILD, duration=0:00:04.585, duration_ms=4585, data={name=NewInstrCalBoard_system, configuration=Debug, clean_build=false}
|
||||||
|
timestamp=[2026-05-26 10:31:41], mode=BUILD, duration=0:00:00.130, duration_ms=130, data={name=NewInstrCalBoard, configuration=Debug, clean_build=false}
|
||||||
|
timestamp=[2026-05-26 10:31:46], mode=BUILD, duration=0:00:04.531, duration_ms=4531, data={name=NewInstrCalBoard_system, configuration=Debug, clean_build=false}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# Force LF line endings for all text files (auto-converted to CRLF on Windows checkout)
|
||||||
|
* text=auto eol=lf
|
||||||
|
|
||||||
|
# XML/project files - ensure consistent line endings
|
||||||
|
*.xml text eol=lf
|
||||||
|
*.prj text eol=lf
|
||||||
|
*.sprj text eol=lf
|
||||||
|
|
||||||
|
# C/C++ source files
|
||||||
|
*.c text eol=lf
|
||||||
|
*.h text eol=lf
|
||||||
|
*.ld text eol=lf
|
||||||
|
*.tcl text eol=lf
|
||||||
|
|
||||||
|
# Configuration files
|
||||||
|
*.json text eol=lf
|
||||||
|
*.mk text eol=lf
|
||||||
|
|
||||||
|
# Binary files - no line ending conversion
|
||||||
|
*.bit binary
|
||||||
|
*.elf binary
|
||||||
|
*.bif binary
|
||||||
|
*.xsa binary
|
||||||
|
*.xpfm binary
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Vitis IDE workspace — 追踪项目列表,忽略机器特定文件
|
||||||
|
#
|
||||||
|
# 原则:.metadata 中只有项目列表 (.projects/, .safetable/) 需要共享。
|
||||||
|
# 其余都是 IDE 运行时缓存,可自动重生,不应提交。
|
||||||
|
|
||||||
|
# ── 机器特定:锁和日志 ──────────────────────────────────────
|
||||||
|
.metadata/.lock
|
||||||
|
.metadata/.log
|
||||||
|
|
||||||
|
# ── 资源快照 & EGit 数据(每次启动自动重生)─────────────────
|
||||||
|
.metadata/.plugins/org.eclipse.core.resources/0.snap
|
||||||
|
.metadata/.plugins/org.eclipse.core.resources/**/.markers.snap
|
||||||
|
.metadata/.plugins/org.eclipse.core.resources/**/.syncinfo.snap
|
||||||
|
.metadata/.plugins/org.eclipse.core.resources/.history/
|
||||||
|
.metadata/.plugins/org.eclipse.core.resources/.projects/*/org.eclipse.egit.core/
|
||||||
|
|
||||||
|
# ── IDE 插件状态(机器特定,自动重生)────────────────────────
|
||||||
|
.metadata/.plugins/org.eclipse.core.runtime/
|
||||||
|
.metadata/.plugins/org.eclipse.ui.workbench/
|
||||||
|
.metadata/.plugins/org.eclipse.e4.workbench/
|
||||||
|
.metadata/.plugins/org.eclipse.debug.core/
|
||||||
|
.metadata/.plugins/org.eclipse.debug.ui/
|
||||||
|
.metadata/.plugins/org.eclipse.ltk.core.refactoring/
|
||||||
|
.metadata/.plugins/org.eclipse.ltk.ui.refactoring/
|
||||||
|
.metadata/.plugins/org.eclipse.cdt.core/
|
||||||
|
.metadata/.plugins/org.eclipse.cdt.make.core/
|
||||||
|
.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/
|
||||||
|
.metadata/.plugins/org.eclipse.cdt.ui/
|
||||||
|
.metadata/.plugins/org.eclipse.jdt.core/
|
||||||
|
.metadata/.plugins/org.eclipse.jdt.ui/
|
||||||
|
.metadata/.plugins/org.eclipse.emf.ecore/
|
||||||
|
.metadata/.plugins/org.eclipse.pde.core/
|
||||||
|
.metadata/.plugins/org.eclipse.rse.core/
|
||||||
|
.metadata/.plugins/org.eclipse.rse.ui/
|
||||||
|
.metadata/.plugins/org.eclipse.tcf/
|
||||||
|
.metadata/.plugins/org.eclipse.tcf.debug/
|
||||||
|
.metadata/.plugins/org.eclipse.tm.terminal.view.ui/
|
||||||
|
.metadata/.plugins/org.eclipse.tracecompass.tmf.analysis.xml.core/
|
||||||
|
.metadata/.plugins/com.xilinx.sdk.utils/
|
||||||
|
.metadata/.plugins/com.xilinx.sdsoc.ui/
|
||||||
|
.metadata/.plugins/com.xilinx.sdx.core/
|
||||||
|
.metadata/.plugins/com.xilinx.sdx.npw/
|
||||||
|
|
||||||
|
# ── 其余机器特定 ───────────────────────────────────────────
|
||||||
|
RemoteSystemsTempFiles/
|
||||||
|
IDE.log
|
||||||
|
*.log
|
||||||
|
.analytics/
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,5 @@
|
|||||||
|
#Tue May 26 10:20:51 UTC 2026
|
||||||
|
org.eclipse.core.runtime=2
|
||||||
|
org.eclipse.platform=4.15.0.v20200305-0155
|
||||||
|
com.xilinx.tools.product=VITIS_IDE
|
||||||
|
com.xilinx.tools.version=2023.2.0
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||||
|
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||||
|
|
||||||
|
<cconfiguration id="org.eclipse.cdt.core.default.config.594092438">
|
||||||
|
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="org.eclipse.cdt.core.default.config.594092438" moduleId="org.eclipse.cdt.core.settings" name="Configuration">
|
||||||
|
|
||||||
|
<externalSettings/>
|
||||||
|
|
||||||
|
<extensions/>
|
||||||
|
|
||||||
|
</storageModule>
|
||||||
|
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
|
|
||||||
|
</cconfiguration>
|
||||||
|
|
||||||
|
</storageModule>
|
||||||
|
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
|
|
||||||
|
</cproject>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Build artifacts
|
||||||
|
*.o
|
||||||
|
*.d
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>NewInstCal_bsp</name>
|
||||||
|
<comment>Created by Vitis v2023.2</comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>com.xilinx.sdx.scw.PlatformProjectBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>com.xilinx.sdx.scw.platformProject</nature>
|
||||||
|
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<sdx:platform sdx:vendor="xilinx.com"
|
||||||
|
sdx:library="sdx"
|
||||||
|
sdx:name="NewInstCal_bsp"
|
||||||
|
sdx:version="1.0"
|
||||||
|
xmlns:sdx="http://www.xilinx.com/sdx">
|
||||||
|
<sdx:description>
|
||||||
|
NewInstCal_bsp
|
||||||
|
</sdx:description>
|
||||||
|
<sdx:hardwarePlatforms>
|
||||||
|
<sdx:hardwarePlatform sdx:path="hw" sdx:name="system_wrapper.xsa"/>
|
||||||
|
</sdx:hardwarePlatforms>
|
||||||
|
<sdx:softwarePlatforms>
|
||||||
|
<sdx:softwarePlatform sdx:path="sw" sdx:name="NewInstCal_bsp.spfm"/>
|
||||||
|
</sdx:softwarePlatforms>
|
||||||
|
</sdx:platform>
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,117 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2020 Xilinx, Inc. All rights reserved.
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
******************************************************************************/
|
||||||
|
/****************************************************************************/
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @file ps7_init.h
|
||||||
|
*
|
||||||
|
* This file can be included in FSBL code
|
||||||
|
* to get prototype of ps7_init() function
|
||||||
|
* and error codes
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//typedef unsigned int u32;
|
||||||
|
|
||||||
|
|
||||||
|
/** do we need to make this name more unique ? **/
|
||||||
|
//extern u32 ps7_init_data[];
|
||||||
|
extern unsigned long * ps7_ddr_init_data;
|
||||||
|
extern unsigned long * ps7_mio_init_data;
|
||||||
|
extern unsigned long * ps7_pll_init_data;
|
||||||
|
extern unsigned long * ps7_clock_init_data;
|
||||||
|
extern unsigned long * ps7_peripherals_init_data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define OPCODE_EXIT 0U
|
||||||
|
#define OPCODE_CLEAR 1U
|
||||||
|
#define OPCODE_WRITE 2U
|
||||||
|
#define OPCODE_MASKWRITE 3U
|
||||||
|
#define OPCODE_MASKPOLL 4U
|
||||||
|
#define OPCODE_MASKDELAY 5U
|
||||||
|
#define NEW_PS7_ERR_CODE 1
|
||||||
|
|
||||||
|
/* Encode number of arguments in last nibble */
|
||||||
|
#define EMIT_EXIT() ( (OPCODE_EXIT << 4 ) | 0 )
|
||||||
|
#define EMIT_CLEAR(addr) ( (OPCODE_CLEAR << 4 ) | 1 ) , addr
|
||||||
|
#define EMIT_WRITE(addr,val) ( (OPCODE_WRITE << 4 ) | 2 ) , addr, val
|
||||||
|
#define EMIT_MASKWRITE(addr,mask,val) ( (OPCODE_MASKWRITE << 4 ) | 3 ) , addr, mask, val
|
||||||
|
#define EMIT_MASKPOLL(addr,mask) ( (OPCODE_MASKPOLL << 4 ) | 2 ) , addr, mask
|
||||||
|
#define EMIT_MASKDELAY(addr,mask) ( (OPCODE_MASKDELAY << 4 ) | 2 ) , addr, mask
|
||||||
|
|
||||||
|
/* Returns codes of PS7_Init */
|
||||||
|
#define PS7_INIT_SUCCESS (0) // 0 is success in good old C
|
||||||
|
#define PS7_INIT_CORRUPT (1) // 1 the data is corrupted, and slcr reg are in corrupted state now
|
||||||
|
#define PS7_INIT_TIMEOUT (2) // 2 when a poll operation timed out
|
||||||
|
#define PS7_POLL_FAILED_DDR_INIT (3) // 3 when a poll operation timed out for ddr init
|
||||||
|
#define PS7_POLL_FAILED_DMA (4) // 4 when a poll operation timed out for dma done bit
|
||||||
|
#define PS7_POLL_FAILED_PLL (5) // 5 when a poll operation timed out for pll sequence init
|
||||||
|
|
||||||
|
|
||||||
|
/* Silicon Versions */
|
||||||
|
#define PCW_SILICON_VERSION_1 0
|
||||||
|
#define PCW_SILICON_VERSION_2 1
|
||||||
|
#define PCW_SILICON_VERSION_3 2
|
||||||
|
|
||||||
|
/* This flag to be used by FSBL to check whether ps7_post_config() proc exixts */
|
||||||
|
#define PS7_POST_CONFIG
|
||||||
|
|
||||||
|
/* Freq of all peripherals */
|
||||||
|
|
||||||
|
#define APU_FREQ 666666687
|
||||||
|
#define DDR_FREQ 533333374
|
||||||
|
#define DCI_FREQ 10158730
|
||||||
|
#define QSPI_FREQ 142857132
|
||||||
|
#define SMC_FREQ 10000000
|
||||||
|
#define ENET0_FREQ 125000000
|
||||||
|
#define ENET1_FREQ 10000000
|
||||||
|
#define USB0_FREQ 60000000
|
||||||
|
#define USB1_FREQ 60000000
|
||||||
|
#define SDIO_FREQ 50000000
|
||||||
|
#define UART_FREQ 100000000
|
||||||
|
#define SPI_FREQ 10000000
|
||||||
|
#define I2C_FREQ 111111115
|
||||||
|
#define WDT_FREQ 111111115
|
||||||
|
#define TTC_FREQ 50000000
|
||||||
|
#define CAN_FREQ 10000000
|
||||||
|
#define PCAP_FREQ 200000000
|
||||||
|
#define TPIU_FREQ 200000000
|
||||||
|
#define FPGA0_FREQ 100000000
|
||||||
|
#define FPGA1_FREQ 10000000
|
||||||
|
#define FPGA2_FREQ 10000000
|
||||||
|
#define FPGA3_FREQ 10000000
|
||||||
|
|
||||||
|
|
||||||
|
/* For delay calculation using global registers*/
|
||||||
|
#define SCU_GLOBAL_TIMER_COUNT_L32 0xF8F00200
|
||||||
|
#define SCU_GLOBAL_TIMER_COUNT_U32 0xF8F00204
|
||||||
|
#define SCU_GLOBAL_TIMER_CONTROL 0xF8F00208
|
||||||
|
#define SCU_GLOBAL_TIMER_AUTO_INC 0xF8F00218
|
||||||
|
|
||||||
|
int ps7_config( unsigned long*);
|
||||||
|
int ps7_init();
|
||||||
|
int ps7_post_config();
|
||||||
|
int ps7_debug();
|
||||||
|
char* getPS7MessageInfo(unsigned key);
|
||||||
|
|
||||||
|
void perf_start_clock(void);
|
||||||
|
void perf_disable_clock(void);
|
||||||
|
void perf_reset_clock(void);
|
||||||
|
void perf_reset_and_start_timer();
|
||||||
|
int get_number_of_cycles_for_delay(unsigned int delay);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,131 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2020 <Xilinx Inc.>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
/****************************************************************************/
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @file ps7_init_gpl.h
|
||||||
|
*
|
||||||
|
* This file can be included in FSBL code
|
||||||
|
* to get prototype of ps7_init() function
|
||||||
|
* and error codes
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//typedef unsigned int u32;
|
||||||
|
|
||||||
|
|
||||||
|
/** do we need to make this name more unique ? **/
|
||||||
|
//extern u32 ps7_init_data[];
|
||||||
|
extern unsigned long * ps7_ddr_init_data;
|
||||||
|
extern unsigned long * ps7_mio_init_data;
|
||||||
|
extern unsigned long * ps7_pll_init_data;
|
||||||
|
extern unsigned long * ps7_clock_init_data;
|
||||||
|
extern unsigned long * ps7_peripherals_init_data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define OPCODE_EXIT 0U
|
||||||
|
#define OPCODE_CLEAR 1U
|
||||||
|
#define OPCODE_WRITE 2U
|
||||||
|
#define OPCODE_MASKWRITE 3U
|
||||||
|
#define OPCODE_MASKPOLL 4U
|
||||||
|
#define OPCODE_MASKDELAY 5U
|
||||||
|
#define NEW_PS7_ERR_CODE 1
|
||||||
|
|
||||||
|
/* Encode number of arguments in last nibble */
|
||||||
|
#define EMIT_EXIT() ( (OPCODE_EXIT << 4 ) | 0 )
|
||||||
|
#define EMIT_CLEAR(addr) ( (OPCODE_CLEAR << 4 ) | 1 ) , addr
|
||||||
|
#define EMIT_WRITE(addr,val) ( (OPCODE_WRITE << 4 ) | 2 ) , addr, val
|
||||||
|
#define EMIT_MASKWRITE(addr,mask,val) ( (OPCODE_MASKWRITE << 4 ) | 3 ) , addr, mask, val
|
||||||
|
#define EMIT_MASKPOLL(addr,mask) ( (OPCODE_MASKPOLL << 4 ) | 2 ) , addr, mask
|
||||||
|
#define EMIT_MASKDELAY(addr,mask) ( (OPCODE_MASKDELAY << 4 ) | 2 ) , addr, mask
|
||||||
|
|
||||||
|
/* Returns codes of PS7_Init */
|
||||||
|
#define PS7_INIT_SUCCESS (0) // 0 is success in good old C
|
||||||
|
#define PS7_INIT_CORRUPT (1) // 1 the data is corrupted, and slcr reg are in corrupted state now
|
||||||
|
#define PS7_INIT_TIMEOUT (2) // 2 when a poll operation timed out
|
||||||
|
#define PS7_POLL_FAILED_DDR_INIT (3) // 3 when a poll operation timed out for ddr init
|
||||||
|
#define PS7_POLL_FAILED_DMA (4) // 4 when a poll operation timed out for dma done bit
|
||||||
|
#define PS7_POLL_FAILED_PLL (5) // 5 when a poll operation timed out for pll sequence init
|
||||||
|
|
||||||
|
|
||||||
|
/* Silicon Versions */
|
||||||
|
#define PCW_SILICON_VERSION_1 0
|
||||||
|
#define PCW_SILICON_VERSION_2 1
|
||||||
|
#define PCW_SILICON_VERSION_3 2
|
||||||
|
|
||||||
|
/* This flag to be used by FSBL to check whether ps7_post_config() proc exixts */
|
||||||
|
#define PS7_POST_CONFIG
|
||||||
|
|
||||||
|
/* Freq of all peripherals */
|
||||||
|
|
||||||
|
#define APU_FREQ 666666687
|
||||||
|
#define DDR_FREQ 533333374
|
||||||
|
#define DCI_FREQ 10158730
|
||||||
|
#define QSPI_FREQ 142857132
|
||||||
|
#define SMC_FREQ 10000000
|
||||||
|
#define ENET0_FREQ 125000000
|
||||||
|
#define ENET1_FREQ 10000000
|
||||||
|
#define USB0_FREQ 60000000
|
||||||
|
#define USB1_FREQ 60000000
|
||||||
|
#define SDIO_FREQ 50000000
|
||||||
|
#define UART_FREQ 100000000
|
||||||
|
#define SPI_FREQ 10000000
|
||||||
|
#define I2C_FREQ 111111115
|
||||||
|
#define WDT_FREQ 111111115
|
||||||
|
#define TTC_FREQ 50000000
|
||||||
|
#define CAN_FREQ 10000000
|
||||||
|
#define PCAP_FREQ 200000000
|
||||||
|
#define TPIU_FREQ 200000000
|
||||||
|
#define FPGA0_FREQ 100000000
|
||||||
|
#define FPGA1_FREQ 10000000
|
||||||
|
#define FPGA2_FREQ 10000000
|
||||||
|
#define FPGA3_FREQ 10000000
|
||||||
|
|
||||||
|
|
||||||
|
/* For delay calculation using global registers*/
|
||||||
|
#define SCU_GLOBAL_TIMER_COUNT_L32 0xF8F00200
|
||||||
|
#define SCU_GLOBAL_TIMER_COUNT_U32 0xF8F00204
|
||||||
|
#define SCU_GLOBAL_TIMER_CONTROL 0xF8F00208
|
||||||
|
#define SCU_GLOBAL_TIMER_AUTO_INC 0xF8F00218
|
||||||
|
|
||||||
|
int ps7_config( unsigned long*);
|
||||||
|
int ps7_init();
|
||||||
|
int ps7_post_config();
|
||||||
|
int ps7_debug();
|
||||||
|
char* getPS7MessageInfo(unsigned key);
|
||||||
|
|
||||||
|
void perf_start_clock(void);
|
||||||
|
void perf_disable_clock(void);
|
||||||
|
void perf_reset_clock(void);
|
||||||
|
void perf_reset_and_start_timer();
|
||||||
|
int get_number_of_cycles_for_delay(unsigned int delay);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<sdx:platform sdx:vendor="xilinx.com"
|
||||||
|
sdx:library="sdx"
|
||||||
|
sdx:name="NewInstCal_bsp"
|
||||||
|
sdx:version="1.0"
|
||||||
|
sdx:schemaVersion="1.0"
|
||||||
|
xmlns:sdx="http://www.xilinx.com/sdx">
|
||||||
|
<sdx:description>
|
||||||
|
NewInstCal_bsp
|
||||||
|
</sdx:description>
|
||||||
|
<sdx:systemConfigurations sdx:defaultConfiguration="NewInstCal_bsp">
|
||||||
|
<sdx:configuration sdx:name="NewInstCal_bsp"
|
||||||
|
sdx:displayName="NewInstCal_bsp"
|
||||||
|
sdx:defaultProcessorGroup="standalone_domain"
|
||||||
|
sdx:runtimes="cpp">
|
||||||
|
<sdx:description>NewInstCal_bsp</sdx:description>
|
||||||
|
<sdx:bootImages sdx:default="standard">
|
||||||
|
<sdx:image sdx:name="standard"
|
||||||
|
sdx:bif=""
|
||||||
|
sdx:imageData=""
|
||||||
|
sdx:readme="NewInstCal_bsp/boot/generic.readme"
|
||||||
|
sdx:qemuArguments="NewInstCal_bsp/qemu/qemu_args.txt"
|
||||||
|
/>
|
||||||
|
<sdx:image sdx:name="standalone_domain"
|
||||||
|
sdx:bif="NewInstCal_bsp/boot/NewInstCal_bsp.bif"
|
||||||
|
sdx:readme="NewInstCal_bsp/boot/generic.readme"
|
||||||
|
sdx:qemuArguments="NewInstCal_bsp/standalone_domain/qemu/qemu_args.txt"
|
||||||
|
/>
|
||||||
|
</sdx:bootImages>
|
||||||
|
<sdx:processorGroup sdx:name="standalone_domain"
|
||||||
|
sdx:displayName="standalone on ps7_cortexa9_0"
|
||||||
|
sdx:cpuType="cortex-a9"
|
||||||
|
sdx:cpuInstance="ps7_cortexa9_0">
|
||||||
|
<sdx:os sdx:name="standalone"
|
||||||
|
sdx:displayName="standalone"
|
||||||
|
sdx:bspLibraryPaths="NewInstCal_bsp/standalone_domain/bsplib/lib"
|
||||||
|
sdx:bspIncludePaths="NewInstCal_bsp/standalone_domain/bspinclude/include"
|
||||||
|
sdx:bspConfig="NewInstCal_bsp/standalone_domain/system.mss"
|
||||||
|
/>
|
||||||
|
</sdx:processorGroup>
|
||||||
|
</sdx:configuration>
|
||||||
|
</sdx:systemConfigurations>
|
||||||
|
</sdx:platform>
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
/*NewInstCal_bsp*/
|
||||||
|
the_ROM_image:
|
||||||
|
{
|
||||||
|
[bootloader]<NewInstCal_bsp/boot/fsbl.elf>
|
||||||
|
<bitstream>
|
||||||
|
<elf,ps7_cortexa9_0>
|
||||||
|
}
|
||||||
BIN
Binary file not shown.
+8
@@ -0,0 +1,8 @@
|
|||||||
|
-= SD card boot image =-
|
||||||
|
|
||||||
|
Platform: <platform>
|
||||||
|
Application: <elf>
|
||||||
|
|
||||||
|
1. Copy the contents of this directory to an SD card
|
||||||
|
2. Set boot mode to SD
|
||||||
|
3. Insert SD card and turn board on
|
||||||
+51
@@ -0,0 +1,51 @@
|
|||||||
|
########################################################################
|
||||||
|
# This is file which used to generate QEMU(which emulates A9 core)
|
||||||
|
# commandline(start_qemu.sh script) which used in Zynq HW-EMU.
|
||||||
|
# This is a template file which is packaged in platform and it gets
|
||||||
|
# processed by Vitis tool to generate meaningful file.
|
||||||
|
#
|
||||||
|
# This file contains flag and value pairs and they must be seperated
|
||||||
|
# into two lines value followed by flag. Below are the common/mandated
|
||||||
|
# flag and value pairs used for emulating Zynq. User can add more
|
||||||
|
# commandline args to this file depends on requirements.
|
||||||
|
#
|
||||||
|
# For more details on the QEMU commandline, please refer to
|
||||||
|
# the QEMU user guide UG1169.
|
||||||
|
########################################################################
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# selects emulated machine
|
||||||
|
-M
|
||||||
|
arm-generic-fdt-7series
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# redirect the serial port to specified char dev (i.e stdio, tcp port, file etc)
|
||||||
|
-serial
|
||||||
|
/dev/null
|
||||||
|
-serial
|
||||||
|
mon:stdio
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Register writes to SLCR block, to set PLL and CLK_CTRL regs (required for linux)
|
||||||
|
-device
|
||||||
|
loader,addr=0xf8000008,data=0xDF0D,data-len=4
|
||||||
|
-device
|
||||||
|
loader,addr=0xf8000140,data=0x00500801,data-len=4
|
||||||
|
-device
|
||||||
|
loader,addr=0xf800012c,data=0x1ed044d,data-len=4
|
||||||
|
-device
|
||||||
|
loader,addr=0xf8000108,data=0x0001e008,data-len=4
|
||||||
|
-device
|
||||||
|
loader,addr=0xF800025C,data=0x00000005,data-len=4
|
||||||
|
-device
|
||||||
|
loader,addr=0xF8000240,data=0x00000000,data-len=4
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Boot device selection
|
||||||
|
-boot
|
||||||
|
mode=5
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Guest software to load during boot up
|
||||||
|
-kernel
|
||||||
|
<elf>
|
||||||
+281
@@ -0,0 +1,281 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2004 - 2020 Xilinx, Inc. All rights reserved.
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef PROFILE_TIMER_HW_H
|
||||||
|
#define PROFILE_TIMER_HW_H
|
||||||
|
|
||||||
|
#include "profile.h"
|
||||||
|
|
||||||
|
#ifdef PROC_PPC
|
||||||
|
#if defined __GNUC__
|
||||||
|
# define SYNCHRONIZE_IO __asm__ volatile ("eieio")
|
||||||
|
#elif defined __DCC__
|
||||||
|
# define SYNCHRONIZE_IO __asm volatile(" eieio")
|
||||||
|
#else
|
||||||
|
# define SYNCHRONIZE_IO
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PROC_PPC
|
||||||
|
#define ProfIo_In32(InputPtr) { (*(volatile u32 *)(InputPtr)); SYNCHRONIZE_IO; }
|
||||||
|
#define ProfIo_Out32(OutputPtr, Value) { (*(volatile u32 *)(OutputPtr) = Value); SYNCHRONIZE_IO; }
|
||||||
|
#else
|
||||||
|
#define ProfIo_In32(InputPtr) (*(volatile u32 *)(InputPtr));
|
||||||
|
#define ProfIo_Out32(OutputPtr, Value) { (*(volatile u32 *)(OutputPtr) = (Value)); }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ProfTmrCtr_mWriteReg(BaseAddress, TmrCtrNumber, RegOffset, ValueToWrite)\
|
||||||
|
ProfIo_Out32(((u32)(BaseAddress) + (u32)XTmrCtr_Offsets[(TmrCtrNumber)] + \
|
||||||
|
(u32)(RegOffset)), (u32)(ValueToWrite))
|
||||||
|
|
||||||
|
#define ProfTimerCtr_mReadReg(BaseAddress, TmrCtrNumber, RegOffset) \
|
||||||
|
ProfIo_In32((u32)(BaseAddress) + (u32)XTmrCtr_Offsets[(TmrCtrNumber)] + (u32)(RegOffset))
|
||||||
|
|
||||||
|
#define ProfTmrCtr_mSetControlStatusReg(BaseAddress, TmrCtrNumber, RegisterValue)\
|
||||||
|
ProfTmrCtr_mWriteReg((BaseAddress), (TmrCtrNumber), XTC_TCSR_OFFSET, \
|
||||||
|
(RegisterValue))
|
||||||
|
|
||||||
|
#define ProfTmrCtr_mGetControlStatusReg(BaseAddress, TmrCtrNumber) \
|
||||||
|
ProfTimerCtr_mReadReg((u32)(BaseAddress), (TmrCtrNumber), XTC_TCSR_OFFSET)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PROC_PPC
|
||||||
|
#include "xexception_l.h"
|
||||||
|
#include "xtime_l.h"
|
||||||
|
#include "xpseudo_asm.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TIMER_CONNECT_INTC
|
||||||
|
#include "xintc_l.h"
|
||||||
|
#include "xintc.h"
|
||||||
|
#endif /* TIMER_CONNECT_INTC */
|
||||||
|
|
||||||
|
#if (!defined PPC_PIT_INTERRUPT && !defined PROC_CORTEXA9)
|
||||||
|
#include "xtmrctr_l.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PROC_CORTEXA9
|
||||||
|
#include "xscutimer_hw.h"
|
||||||
|
#include "xscugic.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern u32 timer_clk_ticks ;
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------
|
||||||
|
* PowerPC Target - Timer related functions
|
||||||
|
*-------------------------------------------------------------------- */
|
||||||
|
#ifdef PROC_PPC
|
||||||
|
|
||||||
|
#ifdef PPC_PIT_INTERRUPT
|
||||||
|
u32 timer_lo_clk_ticks ; /* Clk ticks when Timer is disabled in CG */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PROC_PPC440
|
||||||
|
#define XREG_TCR_PIT_INTERRUPT_ENABLE XREG_TCR_DEC_INTERRUPT_ENABLE
|
||||||
|
#define XREG_TSR_PIT_INTERRUPT_STATUS XREG_TSR_DEC_INTERRUPT_STATUS
|
||||||
|
#define XREG_SPR_PIT XREG_SPR_DEC
|
||||||
|
#define XEXC_ID_PIT_INT XEXC_ID_DEC_INT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------
|
||||||
|
* Disable the Timer - During Profiling
|
||||||
|
*
|
||||||
|
* For PIT Timer -
|
||||||
|
* 1. XTime_PITDisableInterrupt() ;
|
||||||
|
* 2. Store the remaining timer clk tick
|
||||||
|
* 3. Stop the PIT Timer
|
||||||
|
*-------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifdef PPC_PIT_INTERRUPT
|
||||||
|
#define disable_timer() \
|
||||||
|
{ \
|
||||||
|
u32 val; \
|
||||||
|
val=mfspr(XREG_SPR_TCR); \
|
||||||
|
mtspr(XREG_SPR_TCR, val & (~XREG_TCR_PIT_INTERRUPT_ENABLE)); \
|
||||||
|
timer_lo_clk_ticks = mfspr(XREG_SPR_PIT); \
|
||||||
|
mtspr(XREG_SPR_PIT, 0); \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define disable_timer() \
|
||||||
|
{ \
|
||||||
|
u32 addr = (PROFILE_TIMER_BASEADDR) + XTmrCtr_Offsets[(0)] + XTC_TCSR_OFFSET; \
|
||||||
|
u32 tmp_v = ProfIo_In32(addr); \
|
||||||
|
tmp_v = tmp_v & (~XTC_CSR_ENABLE_TMR_MASK); \
|
||||||
|
ProfIo_Out32((PROFILE_TIMER_BASEADDR) + XTmrCtr_Offsets[(0)] + XTC_TCSR_OFFSET, tmp_v); \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------
|
||||||
|
* Enable the Timer
|
||||||
|
*
|
||||||
|
* For PIT Timer -
|
||||||
|
* 1. Load the remaining timer clk ticks
|
||||||
|
* 2. XTime_PITEnableInterrupt() ;
|
||||||
|
*-------------------------------------------------------------------- */
|
||||||
|
#ifdef PPC_PIT_INTERRUPT
|
||||||
|
#define enable_timer() \
|
||||||
|
{ \
|
||||||
|
u32 val; \
|
||||||
|
val=mfspr(XREG_SPR_TCR); \
|
||||||
|
mtspr(XREG_SPR_PIT, timer_lo_clk_ticks); \
|
||||||
|
mtspr(XREG_SPR_TCR, val | XREG_TCR_PIT_INTERRUPT_ENABLE); \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define enable_timer() \
|
||||||
|
{ \
|
||||||
|
u32 addr = (PROFILE_TIMER_BASEADDR) + XTmrCtr_Offsets[(0)] + XTC_TCSR_OFFSET; \
|
||||||
|
u32 tmp_v = ProfIo_In32(addr); \
|
||||||
|
tmp_v = tmp_v | XTC_CSR_ENABLE_TMR_MASK; \
|
||||||
|
ProfIo_Out32((PROFILE_TIMER_BASEADDR) + XTmrCtr_Offsets[(0)] + XTC_TCSR_OFFSET, tmp_v); \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------
|
||||||
|
* Send Ack to Timer Interrupt
|
||||||
|
*
|
||||||
|
* For PIT Timer -
|
||||||
|
* 1. Load the timer clk ticks
|
||||||
|
* 2. Enable AutoReload and Interrupt
|
||||||
|
* 3. Clear PIT Timer Status bits
|
||||||
|
*-------------------------------------------------------------------- */
|
||||||
|
#ifdef PPC_PIT_INTERRUPT
|
||||||
|
#define timer_ack() \
|
||||||
|
{ \
|
||||||
|
u32 val; \
|
||||||
|
mtspr(XREG_SPR_PIT, timer_clk_ticks); \
|
||||||
|
mtspr(XREG_SPR_TSR, XREG_TSR_PIT_INTERRUPT_STATUS); \
|
||||||
|
val=mfspr(XREG_SPR_TCR); \
|
||||||
|
mtspr(XREG_SPR_TCR, val| XREG_TCR_PIT_INTERRUPT_ENABLE| XREG_TCR_AUTORELOAD_ENABLE); \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define timer_ack() \
|
||||||
|
{ \
|
||||||
|
u32 csr; \
|
||||||
|
csr = ProfTmrCtr_mGetControlStatusReg(PROFILE_TIMER_BASEADDR, 0); \
|
||||||
|
ProfTmrCtr_mSetControlStatusReg(PROFILE_TIMER_BASEADDR, 0, csr); \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------- */
|
||||||
|
#endif /* PROC_PPC */
|
||||||
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------
|
||||||
|
* MicroBlaze Target - Timer related functions
|
||||||
|
*-------------------------------------------------------------------- */
|
||||||
|
#ifdef PROC_MICROBLAZE
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------
|
||||||
|
* Disable the Timer during Call-Graph Data collection
|
||||||
|
*
|
||||||
|
*-------------------------------------------------------------------- */
|
||||||
|
#define disable_timer() \
|
||||||
|
{ \
|
||||||
|
u32 Addr = ((u32)PROFILE_TIMER_BASEADDR); \
|
||||||
|
Addr += (u32)XTmrCtr_Offsets[(u16)(0)]; \
|
||||||
|
Addr += (u32)XTC_TCSR_OFFSET; \
|
||||||
|
u32 tmp_v = ProfIo_In32(Addr); \
|
||||||
|
tmp_v = tmp_v & (u32)(~XTC_CSR_ENABLE_TMR_MASK); \
|
||||||
|
u32 OutAddr = (u32)PROFILE_TIMER_BASEADDR; \
|
||||||
|
OutAddr += (u32)XTmrCtr_Offsets[(u16)(0)]; \
|
||||||
|
OutAddr += (u32)XTC_TCSR_OFFSET; \
|
||||||
|
ProfIo_Out32(OutAddr, (u32)tmp_v); \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------
|
||||||
|
* Enable the Timer after Call-Graph Data collection
|
||||||
|
*
|
||||||
|
*-------------------------------------------------------------------- */
|
||||||
|
#define enable_timer() \
|
||||||
|
{ \
|
||||||
|
u32 Addr = ((u32)PROFILE_TIMER_BASEADDR); \
|
||||||
|
Addr += (u32)XTmrCtr_Offsets[(u16)(0)]; \
|
||||||
|
Addr += (u32)XTC_TCSR_OFFSET; \
|
||||||
|
u32 tmp_v = (u32)ProfIo_In32(Addr); \
|
||||||
|
tmp_v = tmp_v | (u32)XTC_CSR_ENABLE_TMR_MASK; \
|
||||||
|
ProfIo_Out32((u32)(PROFILE_TIMER_BASEADDR) + (u32)XTmrCtr_Offsets[(u16)(0)] + (u32)XTC_TCSR_OFFSET, (u32)tmp_v); \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------
|
||||||
|
* Send Ack to Timer Interrupt
|
||||||
|
*
|
||||||
|
*-------------------------------------------------------------------- */
|
||||||
|
#define timer_ack() \
|
||||||
|
{ \
|
||||||
|
u32 csr; \
|
||||||
|
csr = ProfTmrCtr_mGetControlStatusReg((u32)PROFILE_TIMER_BASEADDR, (u16)0); \
|
||||||
|
ProfTmrCtr_mSetControlStatusReg((u32)PROFILE_TIMER_BASEADDR, (u16)0, (u32)csr); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------- */
|
||||||
|
#endif /* PROC_MICROBLAZE */
|
||||||
|
/*-------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------
|
||||||
|
* Cortex A9 Target - Timer related functions
|
||||||
|
*-------------------------------------------------------------------- */
|
||||||
|
#ifdef PROC_CORTEXA9
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------
|
||||||
|
* Disable the Timer during Call-Graph Data collection
|
||||||
|
*
|
||||||
|
*-------------------------------------------------------------------- */
|
||||||
|
#define disable_timer() \
|
||||||
|
{ \
|
||||||
|
u32 Reg; \
|
||||||
|
Reg = Xil_In32(PROFILE_TIMER_BASEADDR + XSCUTIMER_CONTROL_OFFSET); \
|
||||||
|
Reg &= (~XSCUTIMER_CONTROL_ENABLE_MASK);\
|
||||||
|
Xil_Out32(PROFILE_TIMER_BASEADDR + XSCUTIMER_CONTROL_OFFSET, Reg);\
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------
|
||||||
|
* Enable the Timer after Call-Graph Data collection
|
||||||
|
*
|
||||||
|
*-------------------------------------------------------------------- */
|
||||||
|
#define enable_timer() \
|
||||||
|
{ \
|
||||||
|
u32 Reg; \
|
||||||
|
Reg = Xil_In32(PROFILE_TIMER_BASEADDR + XSCUTIMER_CONTROL_OFFSET); \
|
||||||
|
Reg |= XSCUTIMER_CONTROL_ENABLE_MASK; \
|
||||||
|
Xil_Out32(PROFILE_TIMER_BASEADDR + XSCUTIMER_CONTROL_OFFSET, Reg);\
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------
|
||||||
|
* Send Ack to Timer Interrupt
|
||||||
|
*
|
||||||
|
*-------------------------------------------------------------------- */
|
||||||
|
#define timer_ack() \
|
||||||
|
{ \
|
||||||
|
Xil_Out32((u32)PROFILE_TIMER_BASEADDR + (u32)XSCUTIMER_ISR_OFFSET, \
|
||||||
|
(u32)XSCUTIMER_ISR_EVENT_FLAG_MASK);\
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------- */
|
||||||
|
#endif /* PROC_CORTEXA9 */
|
||||||
|
/*-------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
+83
@@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||||
|
* Copyright (C) 2007 - 2022 Xilinx, Inc.
|
||||||
|
* Copyright (C) 2022 - 2023 Advanced Micro Devices, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||||
|
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ARCH_CC_H__
|
||||||
|
#define __ARCH_CC_H__
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "lwipopts.h"
|
||||||
|
|
||||||
|
/** if you want to use the struct timeval provided
|
||||||
|
* by your system, set this to 0 and include <sys/time.h> in cc.h */
|
||||||
|
#define LWIP_TIMEVAL_PRIVATE 0
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include "cpu.h"
|
||||||
|
|
||||||
|
/* As per new design of lwip-2.0.2,
|
||||||
|
* LWIP_NO_STDINT_H should be defined as 1 in cc.h */
|
||||||
|
#define LWIP_NO_STDINT_H 1
|
||||||
|
|
||||||
|
typedef unsigned char u8_t;
|
||||||
|
typedef signed char s8_t;
|
||||||
|
typedef unsigned short u16_t;
|
||||||
|
typedef signed short s16_t;
|
||||||
|
typedef unsigned int u32_t;
|
||||||
|
typedef signed int s32_t;
|
||||||
|
typedef unsigned long long u64_t;
|
||||||
|
typedef signed long long s64_t;
|
||||||
|
|
||||||
|
#define S16_F "d"
|
||||||
|
#define U16_F "d"
|
||||||
|
#define S32_F "d"
|
||||||
|
#define U32_F "x"
|
||||||
|
|
||||||
|
#define X16_F "x"
|
||||||
|
#define X32_F "x"
|
||||||
|
|
||||||
|
#define LWIP_RAND rand
|
||||||
|
|
||||||
|
typedef unsigned long mem_ptr_t;
|
||||||
|
|
||||||
|
#define PACK_STRUCT_FIELD(x) x
|
||||||
|
#define PACK_STRUCT_STRUCT __attribute__((packed))
|
||||||
|
#define PACK_STRUCT_BEGIN
|
||||||
|
#define PACK_STRUCT_END
|
||||||
|
|
||||||
|
#define LWIP_PLATFORM_ASSERT(x)
|
||||||
|
#define LWIP_PLATFORM_DIAG(x) do { xil_printf x; } while(0)
|
||||||
|
|
||||||
|
#endif /* __ARCH_CC_H__ */
|
||||||
+49
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||||
|
* Copyright (C) 2007 - 2022 Xilinx, Inc.
|
||||||
|
* Copyright (C) 2022 - 2023 Advanced Micro Devices, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||||
|
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ARCH_CPU_H__
|
||||||
|
#define __ARCH_CPU_H__
|
||||||
|
|
||||||
|
#include "lwipopts.h"
|
||||||
|
|
||||||
|
#ifndef BYTE_ORDER
|
||||||
|
#ifdef PROCESSOR_LITTLE_ENDIAN
|
||||||
|
#define BYTE_ORDER LITTLE_ENDIAN
|
||||||
|
#else
|
||||||
|
#define BYTE_ORDER BIG_ENDIAN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ARCH_CPU_H__ */
|
||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||||
|
* Copyright (C) 2007 - 2022 Xilinx, Inc.
|
||||||
|
* Copyright (C) 2022 - 2023 Advanced Micro Devices, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||||
|
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ARCH_PERF_H__
|
||||||
|
#define __ARCH_PERF_H__
|
||||||
|
|
||||||
|
#define PERF_START /* null definition */
|
||||||
|
#define PERF_STOP(x) /* null definition */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void perf_init(char *fname);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ARCH_PERF_H__ */
|
||||||
+74
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||||
|
* Copyright (C) 2007 - 2022 Xilinx, Inc.
|
||||||
|
* Copyright (C) 2022 - 2023 Advanced Micro Devices, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||||
|
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SYS_XILINX_ARCH_H__
|
||||||
|
#define __SYS_XILINX_ARCH_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
#include "lwipopts.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if !NO_SYS
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "queue.h"
|
||||||
|
#include "semphr.h"
|
||||||
|
#include "timers.h"
|
||||||
|
|
||||||
|
#define SYS_MBOX_NULL ( ( xQueueHandle ) NULL )
|
||||||
|
#define SYS_SEM_NULL ( ( xSemaphoreHandle ) NULL )
|
||||||
|
#define SYS_DEFAULT_THREAD_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||||
|
|
||||||
|
typedef xSemaphoreHandle sys_sem_t;
|
||||||
|
typedef xSemaphoreHandle sys_mutex_t;
|
||||||
|
typedef xQueueHandle sys_mbox_t;
|
||||||
|
typedef xTaskHandle sys_thread_t;
|
||||||
|
|
||||||
|
typedef unsigned long sys_prot_t;
|
||||||
|
|
||||||
|
#define sys_mbox_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE )
|
||||||
|
#define sys_mbox_set_invalid( x ) ( ( *x ) = NULL )
|
||||||
|
#define sys_sem_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE )
|
||||||
|
#define sys_sem_set_invalid( x ) ( ( *x ) = NULL )
|
||||||
|
#endif /* !NO_SYS */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __SYS_XILINX_ARCH_H__ */
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
/*******************************************************************
|
||||||
|
*
|
||||||
|
* CAUTION: This file is automatically generated by HSI.
|
||||||
|
* Version: 2023.2
|
||||||
|
* DO NOT EDIT.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2026 Xilinx, Inc. All Rights Reserved.
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
*
|
||||||
|
* Description: Configurations for Standalone BSP
|
||||||
|
*
|
||||||
|
*******************************************************************/
|
||||||
|
|
||||||
|
#ifndef BSPCONFIG_H /* prevent circular inclusions */
|
||||||
|
#define BSPCONFIG_H /* by using protection macros */
|
||||||
|
|
||||||
|
#define MICROBLAZE_PVR_NONE
|
||||||
|
|
||||||
|
/* Definition for hard-float ABI */
|
||||||
|
#define FPU_HARD_FLOAT_ABI_ENABLED 1
|
||||||
|
|
||||||
|
#endif /*end of __BSPCONFIG_H_*/
|
||||||
+206
@@ -0,0 +1,206 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Application layered TCP connection API (to be used from TCPIP thread)\n
|
||||||
|
*
|
||||||
|
* This file contains the generic API.
|
||||||
|
* For more details see @ref altcp_api.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2017 Simon Goldschmidt
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Simon Goldschmidt <goldsimon@gmx.de>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_ALTCP_H
|
||||||
|
#define LWIP_HDR_ALTCP_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
#include "lwip/tcpbase.h"
|
||||||
|
#include "lwip/err.h"
|
||||||
|
#include "lwip/pbuf.h"
|
||||||
|
#include "lwip/ip_addr.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct altcp_pcb;
|
||||||
|
struct altcp_functions;
|
||||||
|
|
||||||
|
typedef err_t (*altcp_accept_fn)(void *arg, struct altcp_pcb *new_conn, err_t err);
|
||||||
|
typedef err_t (*altcp_connected_fn)(void *arg, struct altcp_pcb *conn, err_t err);
|
||||||
|
typedef err_t (*altcp_recv_fn)(void *arg, struct altcp_pcb *conn, struct pbuf *p, err_t err);
|
||||||
|
typedef err_t (*altcp_sent_fn)(void *arg, struct altcp_pcb *conn, u16_t len);
|
||||||
|
typedef err_t (*altcp_poll_fn)(void *arg, struct altcp_pcb *conn);
|
||||||
|
typedef void (*altcp_err_fn)(void *arg, err_t err);
|
||||||
|
|
||||||
|
typedef struct altcp_pcb* (*altcp_new_fn)(void *arg, u8_t ip_type);
|
||||||
|
|
||||||
|
struct altcp_pcb {
|
||||||
|
const struct altcp_functions *fns;
|
||||||
|
struct altcp_pcb *inner_conn;
|
||||||
|
void *arg;
|
||||||
|
void *state;
|
||||||
|
/* application callbacks */
|
||||||
|
altcp_accept_fn accept;
|
||||||
|
altcp_connected_fn connected;
|
||||||
|
altcp_recv_fn recv;
|
||||||
|
altcp_sent_fn sent;
|
||||||
|
altcp_poll_fn poll;
|
||||||
|
altcp_err_fn err;
|
||||||
|
u8_t pollinterval;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @ingroup altcp */
|
||||||
|
typedef struct altcp_allocator_s {
|
||||||
|
/** Allocator function */
|
||||||
|
altcp_new_fn alloc;
|
||||||
|
/** Argument to allocator function */
|
||||||
|
void *arg;
|
||||||
|
} altcp_allocator_t;
|
||||||
|
|
||||||
|
struct altcp_pcb *altcp_new(altcp_allocator_t *allocator);
|
||||||
|
struct altcp_pcb *altcp_new_ip6(altcp_allocator_t *allocator);
|
||||||
|
struct altcp_pcb *altcp_new_ip_type(altcp_allocator_t *allocator, u8_t ip_type);
|
||||||
|
|
||||||
|
void altcp_arg(struct altcp_pcb *conn, void *arg);
|
||||||
|
void altcp_accept(struct altcp_pcb *conn, altcp_accept_fn accept);
|
||||||
|
void altcp_recv(struct altcp_pcb *conn, altcp_recv_fn recv);
|
||||||
|
void altcp_sent(struct altcp_pcb *conn, altcp_sent_fn sent);
|
||||||
|
void altcp_poll(struct altcp_pcb *conn, altcp_poll_fn poll, u8_t interval);
|
||||||
|
void altcp_err(struct altcp_pcb *conn, altcp_err_fn err);
|
||||||
|
|
||||||
|
void altcp_recved(struct altcp_pcb *conn, u16_t len);
|
||||||
|
err_t altcp_bind(struct altcp_pcb *conn, const ip_addr_t *ipaddr, u16_t port);
|
||||||
|
err_t altcp_connect(struct altcp_pcb *conn, const ip_addr_t *ipaddr, u16_t port, altcp_connected_fn connected);
|
||||||
|
|
||||||
|
/* return conn for source code compatibility to tcp callback API only */
|
||||||
|
struct altcp_pcb *altcp_listen_with_backlog_and_err(struct altcp_pcb *conn, u8_t backlog, err_t *err);
|
||||||
|
#define altcp_listen_with_backlog(conn, backlog) altcp_listen_with_backlog_and_err(conn, backlog, NULL)
|
||||||
|
/** @ingroup altcp */
|
||||||
|
#define altcp_listen(conn) altcp_listen_with_backlog_and_err(conn, TCP_DEFAULT_LISTEN_BACKLOG, NULL)
|
||||||
|
|
||||||
|
void altcp_abort(struct altcp_pcb *conn);
|
||||||
|
err_t altcp_close(struct altcp_pcb *conn);
|
||||||
|
err_t altcp_shutdown(struct altcp_pcb *conn, int shut_rx, int shut_tx);
|
||||||
|
|
||||||
|
err_t altcp_write(struct altcp_pcb *conn, const void *dataptr, u16_t len, u8_t apiflags);
|
||||||
|
err_t altcp_output(struct altcp_pcb *conn);
|
||||||
|
|
||||||
|
u16_t altcp_mss(struct altcp_pcb *conn);
|
||||||
|
u16_t altcp_sndbuf(struct altcp_pcb *conn);
|
||||||
|
u16_t altcp_sndqueuelen(struct altcp_pcb *conn);
|
||||||
|
void altcp_nagle_disable(struct altcp_pcb *conn);
|
||||||
|
void altcp_nagle_enable(struct altcp_pcb *conn);
|
||||||
|
int altcp_nagle_disabled(struct altcp_pcb *conn);
|
||||||
|
|
||||||
|
void altcp_setprio(struct altcp_pcb *conn, u8_t prio);
|
||||||
|
|
||||||
|
err_t altcp_get_tcp_addrinfo(struct altcp_pcb *conn, int local, ip_addr_t *addr, u16_t *port);
|
||||||
|
ip_addr_t *altcp_get_ip(struct altcp_pcb *conn, int local);
|
||||||
|
u16_t altcp_get_port(struct altcp_pcb *conn, int local);
|
||||||
|
|
||||||
|
#if LWIP_TCP_KEEPALIVE
|
||||||
|
void altcp_keepalive_disable(struct altcp_pcb *conn);
|
||||||
|
void altcp_keepalive_enable(struct altcp_pcb *conn, u32_t idle, u32_t intvl, u32_t count);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef LWIP_DEBUG
|
||||||
|
enum tcp_state altcp_dbg_get_tcp_state(struct altcp_pcb *conn);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /* LWIP_ALTCP */
|
||||||
|
|
||||||
|
/* ALTCP disabled, define everything to link against tcp callback API (e.g. to get a small non-ssl httpd) */
|
||||||
|
|
||||||
|
#include "lwip/tcp.h"
|
||||||
|
|
||||||
|
#define altcp_accept_fn tcp_accept_fn
|
||||||
|
#define altcp_connected_fn tcp_connected_fn
|
||||||
|
#define altcp_recv_fn tcp_recv_fn
|
||||||
|
#define altcp_sent_fn tcp_sent_fn
|
||||||
|
#define altcp_poll_fn tcp_poll_fn
|
||||||
|
#define altcp_err_fn tcp_err_fn
|
||||||
|
|
||||||
|
#define altcp_pcb tcp_pcb
|
||||||
|
#define altcp_tcp_new_ip_type tcp_new_ip_type
|
||||||
|
#define altcp_tcp_new tcp_new
|
||||||
|
#define altcp_tcp_new_ip6 tcp_new_ip6
|
||||||
|
|
||||||
|
#define altcp_new(allocator) tcp_new()
|
||||||
|
#define altcp_new_ip6(allocator) tcp_new_ip6()
|
||||||
|
#define altcp_new_ip_type(allocator, ip_type) tcp_new_ip_type(ip_type)
|
||||||
|
|
||||||
|
#define altcp_arg tcp_arg
|
||||||
|
#define altcp_accept tcp_accept
|
||||||
|
#define altcp_recv tcp_recv
|
||||||
|
#define altcp_sent tcp_sent
|
||||||
|
#define altcp_poll tcp_poll
|
||||||
|
#define altcp_err tcp_err
|
||||||
|
|
||||||
|
#define altcp_recved tcp_recved
|
||||||
|
#define altcp_bind tcp_bind
|
||||||
|
#define altcp_connect tcp_connect
|
||||||
|
|
||||||
|
#define altcp_listen_with_backlog_and_err tcp_listen_with_backlog_and_err
|
||||||
|
#define altcp_listen_with_backlog tcp_listen_with_backlog
|
||||||
|
#define altcp_listen tcp_listen
|
||||||
|
|
||||||
|
#define altcp_abort tcp_abort
|
||||||
|
#define altcp_close tcp_close
|
||||||
|
#define altcp_shutdown tcp_shutdown
|
||||||
|
|
||||||
|
#define altcp_write tcp_write
|
||||||
|
#define altcp_output tcp_output
|
||||||
|
|
||||||
|
#define altcp_mss tcp_mss
|
||||||
|
#define altcp_sndbuf tcp_sndbuf
|
||||||
|
#define altcp_sndqueuelen tcp_sndqueuelen
|
||||||
|
#define altcp_nagle_disable tcp_nagle_disable
|
||||||
|
#define altcp_nagle_enable tcp_nagle_enable
|
||||||
|
#define altcp_nagle_disabled tcp_nagle_disabled
|
||||||
|
#define altcp_setprio tcp_setprio
|
||||||
|
|
||||||
|
#define altcp_get_tcp_addrinfo tcp_get_tcp_addrinfo
|
||||||
|
#define altcp_get_ip(pcb, local) ((local) ? (&(pcb)->local_ip) : (&(pcb)->remote_ip))
|
||||||
|
|
||||||
|
#ifdef LWIP_DEBUG
|
||||||
|
#define altcp_dbg_get_tcp_state tcp_dbg_get_tcp_state
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_ALTCP */
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_ALTCP_H */
|
||||||
+72
@@ -0,0 +1,72 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Application layered TCP connection API (to be used from TCPIP thread)\n
|
||||||
|
* This interface mimics the tcp callback API to the application while preventing
|
||||||
|
* direct linking (much like virtual functions).
|
||||||
|
* This way, an application can make use of other application layer protocols
|
||||||
|
* on top of TCP without knowing the details (e.g. TLS, proxy connection).
|
||||||
|
*
|
||||||
|
* This file contains the base implementation calling into tcp.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2017 Simon Goldschmidt
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Simon Goldschmidt <goldsimon@gmx.de>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_ALTCP_TCP_H
|
||||||
|
#define LWIP_HDR_ALTCP_TCP_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
#include "lwip/altcp.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct altcp_pcb *altcp_tcp_new_ip_type(u8_t ip_type);
|
||||||
|
|
||||||
|
#define altcp_tcp_new() altcp_tcp_new_ip_type(IPADDR_TYPE_V4)
|
||||||
|
#define altcp_tcp_new_ip6() altcp_tcp_new_ip_type(IPADDR_TYPE_V6)
|
||||||
|
|
||||||
|
struct altcp_pcb *altcp_tcp_alloc(void *arg, u8_t ip_type);
|
||||||
|
|
||||||
|
struct tcp_pcb;
|
||||||
|
struct altcp_pcb *altcp_tcp_wrap(struct tcp_pcb *tpcb);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_ALTCP */
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_ALTCP_TCP_H */
|
||||||
+143
@@ -0,0 +1,143 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Application layered TCP/TLS connection API (to be used from TCPIP thread)
|
||||||
|
*
|
||||||
|
* @defgroup altcp_tls TLS layer
|
||||||
|
* @ingroup altcp
|
||||||
|
* This file contains function prototypes for a TLS layer.
|
||||||
|
* A port to ARM mbedtls is provided in the apps/ tree
|
||||||
|
* (LWIP_ALTCP_TLS_MBEDTLS option).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2017 Simon Goldschmidt
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Simon Goldschmidt <goldsimon@gmx.de>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_ALTCP_TLS_H
|
||||||
|
#define LWIP_HDR_ALTCP_TLS_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
#if LWIP_ALTCP_TLS
|
||||||
|
|
||||||
|
#include "lwip/altcp.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** @ingroup altcp_tls
|
||||||
|
* ALTCP_TLS configuration handle, content depends on port (e.g. mbedtls)
|
||||||
|
*/
|
||||||
|
struct altcp_tls_config;
|
||||||
|
|
||||||
|
/** @ingroup altcp_tls
|
||||||
|
* Create an ALTCP_TLS server configuration handle prepared for multiple certificates
|
||||||
|
*/
|
||||||
|
struct altcp_tls_config *altcp_tls_create_config_server(uint8_t cert_count);
|
||||||
|
|
||||||
|
/** @ingroup altcp_tls
|
||||||
|
* Add a certificate to an ALTCP_TLS server configuration handle
|
||||||
|
*/
|
||||||
|
err_t altcp_tls_config_server_add_privkey_cert(struct altcp_tls_config *config,
|
||||||
|
const u8_t *privkey, size_t privkey_len,
|
||||||
|
const u8_t *privkey_pass, size_t privkey_pass_len,
|
||||||
|
const u8_t *cert, size_t cert_len);
|
||||||
|
|
||||||
|
/** @ingroup altcp_tls
|
||||||
|
* Create an ALTCP_TLS server configuration handle with one certificate
|
||||||
|
* (short version of calling @ref altcp_tls_create_config_server and
|
||||||
|
* @ref altcp_tls_config_server_add_privkey_cert)
|
||||||
|
*/
|
||||||
|
struct altcp_tls_config *altcp_tls_create_config_server_privkey_cert(const u8_t *privkey, size_t privkey_len,
|
||||||
|
const u8_t *privkey_pass, size_t privkey_pass_len,
|
||||||
|
const u8_t *cert, size_t cert_len);
|
||||||
|
|
||||||
|
/** @ingroup altcp_tls
|
||||||
|
* Create an ALTCP_TLS client configuration handle
|
||||||
|
*/
|
||||||
|
struct altcp_tls_config *altcp_tls_create_config_client(const u8_t *cert, size_t cert_len);
|
||||||
|
|
||||||
|
/** @ingroup altcp_tls
|
||||||
|
* Create an ALTCP_TLS client configuration handle with two-way server/client authentication
|
||||||
|
*/
|
||||||
|
struct altcp_tls_config *altcp_tls_create_config_client_2wayauth(const u8_t *ca, size_t ca_len, const u8_t *privkey, size_t privkey_len,
|
||||||
|
const u8_t *privkey_pass, size_t privkey_pass_len,
|
||||||
|
const u8_t *cert, size_t cert_len);
|
||||||
|
|
||||||
|
/** @ingroup altcp_tls
|
||||||
|
* Free an ALTCP_TLS configuration handle
|
||||||
|
*/
|
||||||
|
void altcp_tls_free_config(struct altcp_tls_config *conf);
|
||||||
|
|
||||||
|
/** @ingroup altcp_tls
|
||||||
|
* Free an ALTCP_TLS global entropy instance.
|
||||||
|
* All ALTCP_TLS configuration are linked to one altcp_tls_entropy_rng structure
|
||||||
|
* that handle an unique system entropy & ctr_drbg instance.
|
||||||
|
* This function allow application to free this altcp_tls_entropy_rng structure
|
||||||
|
* when all configuration referencing it were destroyed.
|
||||||
|
* This function does nothing if some ALTCP_TLS configuration handle are still
|
||||||
|
* active.
|
||||||
|
*/
|
||||||
|
void altcp_tls_free_entropy(void);
|
||||||
|
|
||||||
|
/** @ingroup altcp_tls
|
||||||
|
* Create new ALTCP_TLS layer wrapping an existing pcb as inner connection (e.g. TLS over TCP)
|
||||||
|
*/
|
||||||
|
struct altcp_pcb *altcp_tls_wrap(struct altcp_tls_config *config, struct altcp_pcb *inner_pcb);
|
||||||
|
|
||||||
|
/** @ingroup altcp_tls
|
||||||
|
* Create new ALTCP_TLS pcb and its inner tcp pcb
|
||||||
|
*/
|
||||||
|
struct altcp_pcb *altcp_tls_new(struct altcp_tls_config *config, u8_t ip_type);
|
||||||
|
|
||||||
|
/** @ingroup altcp_tls
|
||||||
|
* Create new ALTCP_TLS layer pcb and its inner tcp pcb.
|
||||||
|
* Same as @ref altcp_tls_new but this allocator function fits to
|
||||||
|
* @ref altcp_allocator_t / @ref altcp_new.\n
|
||||||
|
'arg' must contain a struct altcp_tls_config *.
|
||||||
|
*/
|
||||||
|
struct altcp_pcb *altcp_tls_alloc(void *arg, u8_t ip_type);
|
||||||
|
|
||||||
|
/** @ingroup altcp_tls
|
||||||
|
* Return pointer to internal TLS context so application can tweak it.
|
||||||
|
* Real type depends on port (e.g. mbedtls)
|
||||||
|
*/
|
||||||
|
void *altcp_tls_context(struct altcp_pcb *conn);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_ALTCP_TLS */
|
||||||
|
#endif /* LWIP_ALTCP */
|
||||||
|
#endif /* LWIP_HDR_ALTCP_TLS_H */
|
||||||
+431
@@ -0,0 +1,431 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* netconn API (to be used from non-TCPIP threads)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_API_H
|
||||||
|
#define LWIP_HDR_API_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if LWIP_NETCONN || LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */
|
||||||
|
/* Note: Netconn API is always available when sockets are enabled -
|
||||||
|
* sockets are implemented on top of them */
|
||||||
|
|
||||||
|
#include "lwip/arch.h"
|
||||||
|
#include "lwip/netbuf.h"
|
||||||
|
#include "lwip/sys.h"
|
||||||
|
#include "lwip/ip_addr.h"
|
||||||
|
#include "lwip/err.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Throughout this file, IP addresses and port numbers are expected to be in
|
||||||
|
* the same byte order as in the corresponding pcb.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Flags for netconn_write (u8_t) */
|
||||||
|
#define NETCONN_NOFLAG 0x00
|
||||||
|
#define NETCONN_NOCOPY 0x00 /* Only for source code compatibility */
|
||||||
|
#define NETCONN_COPY 0x01
|
||||||
|
#define NETCONN_MORE 0x02
|
||||||
|
#define NETCONN_DONTBLOCK 0x04
|
||||||
|
#define NETCONN_NOAUTORCVD 0x08 /* prevent netconn_recv_data_tcp() from updating the tcp window - must be done manually via netconn_tcp_recvd() */
|
||||||
|
#define NETCONN_NOFIN 0x10 /* upper layer already received data, leave FIN in queue until called again */
|
||||||
|
|
||||||
|
/* Flags for struct netconn.flags (u8_t) */
|
||||||
|
/** This netconn had an error, don't block on recvmbox/acceptmbox any more */
|
||||||
|
#define NETCONN_FLAG_MBOXCLOSED 0x01
|
||||||
|
/** Should this netconn avoid blocking? */
|
||||||
|
#define NETCONN_FLAG_NON_BLOCKING 0x02
|
||||||
|
/** Was the last connect action a non-blocking one? */
|
||||||
|
#define NETCONN_FLAG_IN_NONBLOCKING_CONNECT 0x04
|
||||||
|
#if LWIP_NETCONN_FULLDUPLEX
|
||||||
|
/** The mbox of this netconn is being deallocated, don't use it anymore */
|
||||||
|
#define NETCONN_FLAG_MBOXINVALID 0x08
|
||||||
|
#endif /* LWIP_NETCONN_FULLDUPLEX */
|
||||||
|
/** If a nonblocking write has been rejected before, poll_tcp needs to
|
||||||
|
check if the netconn is writable again */
|
||||||
|
#define NETCONN_FLAG_CHECK_WRITESPACE 0x10
|
||||||
|
#if LWIP_IPV6
|
||||||
|
/** If this flag is set then only IPv6 communication is allowed on the
|
||||||
|
netconn. As per RFC#3493 this features defaults to OFF allowing
|
||||||
|
dual-stack usage by default. */
|
||||||
|
#define NETCONN_FLAG_IPV6_V6ONLY 0x20
|
||||||
|
#endif /* LWIP_IPV6 */
|
||||||
|
#if LWIP_NETBUF_RECVINFO
|
||||||
|
/** Received packet info will be recorded for this netconn */
|
||||||
|
#define NETCONN_FLAG_PKTINFO 0x40
|
||||||
|
#endif /* LWIP_NETBUF_RECVINFO */
|
||||||
|
/** A FIN has been received but not passed to the application yet */
|
||||||
|
#define NETCONN_FIN_RX_PENDING 0x80
|
||||||
|
|
||||||
|
/* Helpers to process several netconn_types by the same code */
|
||||||
|
#define NETCONNTYPE_GROUP(t) ((t)&0xF0)
|
||||||
|
#define NETCONNTYPE_DATAGRAM(t) ((t)&0xE0)
|
||||||
|
#if LWIP_IPV6
|
||||||
|
#define NETCONN_TYPE_IPV6 0x08
|
||||||
|
#define NETCONNTYPE_ISIPV6(t) (((t)&NETCONN_TYPE_IPV6) != 0)
|
||||||
|
#define NETCONNTYPE_ISUDPLITE(t) (((t)&0xF3) == NETCONN_UDPLITE)
|
||||||
|
#define NETCONNTYPE_ISUDPNOCHKSUM(t) (((t)&0xF3) == NETCONN_UDPNOCHKSUM)
|
||||||
|
#else /* LWIP_IPV6 */
|
||||||
|
#define NETCONNTYPE_ISIPV6(t) (0)
|
||||||
|
#define NETCONNTYPE_ISUDPLITE(t) ((t) == NETCONN_UDPLITE)
|
||||||
|
#define NETCONNTYPE_ISUDPNOCHKSUM(t) ((t) == NETCONN_UDPNOCHKSUM)
|
||||||
|
#endif /* LWIP_IPV6 */
|
||||||
|
|
||||||
|
/** @ingroup netconn_common
|
||||||
|
* Protocol family and type of the netconn
|
||||||
|
*/
|
||||||
|
enum netconn_type {
|
||||||
|
NETCONN_INVALID = 0,
|
||||||
|
/** TCP IPv4 */
|
||||||
|
NETCONN_TCP = 0x10,
|
||||||
|
#if LWIP_IPV6
|
||||||
|
/** TCP IPv6 */
|
||||||
|
NETCONN_TCP_IPV6 = NETCONN_TCP | NETCONN_TYPE_IPV6 /* 0x18 */,
|
||||||
|
#endif /* LWIP_IPV6 */
|
||||||
|
/** UDP IPv4 */
|
||||||
|
NETCONN_UDP = 0x20,
|
||||||
|
/** UDP IPv4 lite */
|
||||||
|
NETCONN_UDPLITE = 0x21,
|
||||||
|
/** UDP IPv4 no checksum */
|
||||||
|
NETCONN_UDPNOCHKSUM = 0x22,
|
||||||
|
|
||||||
|
#if LWIP_IPV6
|
||||||
|
/** UDP IPv6 (dual-stack by default, unless you call @ref netconn_set_ipv6only) */
|
||||||
|
NETCONN_UDP_IPV6 = NETCONN_UDP | NETCONN_TYPE_IPV6 /* 0x28 */,
|
||||||
|
/** UDP IPv6 lite (dual-stack by default, unless you call @ref netconn_set_ipv6only) */
|
||||||
|
NETCONN_UDPLITE_IPV6 = NETCONN_UDPLITE | NETCONN_TYPE_IPV6 /* 0x29 */,
|
||||||
|
/** UDP IPv6 no checksum (dual-stack by default, unless you call @ref netconn_set_ipv6only) */
|
||||||
|
NETCONN_UDPNOCHKSUM_IPV6 = NETCONN_UDPNOCHKSUM | NETCONN_TYPE_IPV6 /* 0x2a */,
|
||||||
|
#endif /* LWIP_IPV6 */
|
||||||
|
|
||||||
|
/** Raw connection IPv4 */
|
||||||
|
NETCONN_RAW = 0x40
|
||||||
|
#if LWIP_IPV6
|
||||||
|
/** Raw connection IPv6 (dual-stack by default, unless you call @ref netconn_set_ipv6only) */
|
||||||
|
, NETCONN_RAW_IPV6 = NETCONN_RAW | NETCONN_TYPE_IPV6 /* 0x48 */
|
||||||
|
#endif /* LWIP_IPV6 */
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Current state of the netconn. Non-TCP netconns are always
|
||||||
|
* in state NETCONN_NONE! */
|
||||||
|
enum netconn_state {
|
||||||
|
NETCONN_NONE,
|
||||||
|
NETCONN_WRITE,
|
||||||
|
NETCONN_LISTEN,
|
||||||
|
NETCONN_CONNECT,
|
||||||
|
NETCONN_CLOSE
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Used to inform the callback function about changes
|
||||||
|
*
|
||||||
|
* Event explanation:
|
||||||
|
*
|
||||||
|
* In the netconn implementation, there are three ways to block a client:
|
||||||
|
*
|
||||||
|
* - accept mbox (sys_arch_mbox_fetch(&conn->acceptmbox, &accept_ptr, 0); in netconn_accept())
|
||||||
|
* - receive mbox (sys_arch_mbox_fetch(&conn->recvmbox, &buf, 0); in netconn_recv_data())
|
||||||
|
* - send queue is full (sys_arch_sem_wait(LWIP_API_MSG_SEM(msg), 0); in lwip_netconn_do_write())
|
||||||
|
*
|
||||||
|
* The events have to be seen as events signaling the state of these mboxes/semaphores. For non-blocking
|
||||||
|
* connections, you need to know in advance whether a call to a netconn function call would block or not,
|
||||||
|
* and these events tell you about that.
|
||||||
|
*
|
||||||
|
* RCVPLUS events say: Safe to perform a potentially blocking call call once more.
|
||||||
|
* They are counted in sockets - three RCVPLUS events for accept mbox means you are safe
|
||||||
|
* to call netconn_accept 3 times without being blocked.
|
||||||
|
* Same thing for receive mbox.
|
||||||
|
*
|
||||||
|
* RCVMINUS events say: Your call to to a possibly blocking function is "acknowledged".
|
||||||
|
* Socket implementation decrements the counter.
|
||||||
|
*
|
||||||
|
* For TX, there is no need to count, its merely a flag. SENDPLUS means you may send something.
|
||||||
|
* SENDPLUS occurs when enough data was delivered to peer so netconn_send() can be called again.
|
||||||
|
* A SENDMINUS event occurs when the next call to a netconn_send() would be blocking.
|
||||||
|
*/
|
||||||
|
enum netconn_evt {
|
||||||
|
NETCONN_EVT_RCVPLUS,
|
||||||
|
NETCONN_EVT_RCVMINUS,
|
||||||
|
NETCONN_EVT_SENDPLUS,
|
||||||
|
NETCONN_EVT_SENDMINUS,
|
||||||
|
NETCONN_EVT_ERROR
|
||||||
|
};
|
||||||
|
|
||||||
|
#if LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD)
|
||||||
|
/** Used for netconn_join_leave_group() */
|
||||||
|
enum netconn_igmp {
|
||||||
|
NETCONN_JOIN,
|
||||||
|
NETCONN_LEAVE
|
||||||
|
};
|
||||||
|
#endif /* LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD) */
|
||||||
|
|
||||||
|
#if LWIP_DNS
|
||||||
|
/* Used for netconn_gethostbyname_addrtype(), these should match the DNS_ADDRTYPE defines in dns.h */
|
||||||
|
#define NETCONN_DNS_DEFAULT NETCONN_DNS_IPV4_IPV6
|
||||||
|
#define NETCONN_DNS_IPV4 0
|
||||||
|
#define NETCONN_DNS_IPV6 1
|
||||||
|
#define NETCONN_DNS_IPV4_IPV6 2 /* try to resolve IPv4 first, try IPv6 if IPv4 fails only */
|
||||||
|
#define NETCONN_DNS_IPV6_IPV4 3 /* try to resolve IPv6 first, try IPv4 if IPv6 fails only */
|
||||||
|
#endif /* LWIP_DNS */
|
||||||
|
|
||||||
|
/* forward-declare some structs to avoid to include their headers */
|
||||||
|
struct ip_pcb;
|
||||||
|
struct tcp_pcb;
|
||||||
|
struct udp_pcb;
|
||||||
|
struct raw_pcb;
|
||||||
|
struct netconn;
|
||||||
|
struct api_msg;
|
||||||
|
|
||||||
|
/** A callback prototype to inform about events for a netconn */
|
||||||
|
typedef void (* netconn_callback)(struct netconn *, enum netconn_evt, u16_t len);
|
||||||
|
|
||||||
|
/** A netconn descriptor */
|
||||||
|
struct netconn {
|
||||||
|
/** type of the netconn (TCP, UDP or RAW) */
|
||||||
|
enum netconn_type type;
|
||||||
|
/** current state of the netconn */
|
||||||
|
enum netconn_state state;
|
||||||
|
/** the lwIP internal protocol control block */
|
||||||
|
union {
|
||||||
|
struct ip_pcb *ip;
|
||||||
|
struct tcp_pcb *tcp;
|
||||||
|
struct udp_pcb *udp;
|
||||||
|
struct raw_pcb *raw;
|
||||||
|
} pcb;
|
||||||
|
/** the last asynchronous unreported error this netconn had */
|
||||||
|
err_t pending_err;
|
||||||
|
#if !LWIP_NETCONN_SEM_PER_THREAD
|
||||||
|
/** sem that is used to synchronously execute functions in the core context */
|
||||||
|
sys_sem_t op_completed;
|
||||||
|
#endif
|
||||||
|
/** mbox where received packets are stored until they are fetched
|
||||||
|
by the netconn application thread (can grow quite big) */
|
||||||
|
sys_mbox_t recvmbox;
|
||||||
|
#if LWIP_TCP
|
||||||
|
/** mbox where new connections are stored until processed
|
||||||
|
by the application thread */
|
||||||
|
sys_mbox_t acceptmbox;
|
||||||
|
#endif /* LWIP_TCP */
|
||||||
|
#if LWIP_NETCONN_FULLDUPLEX
|
||||||
|
/** number of threads waiting on an mbox. This is required to unblock
|
||||||
|
all threads when closing while threads are waiting. */
|
||||||
|
int mbox_threads_waiting;
|
||||||
|
#endif
|
||||||
|
/** only used for socket layer */
|
||||||
|
#if LWIP_SOCKET
|
||||||
|
int socket;
|
||||||
|
#endif /* LWIP_SOCKET */
|
||||||
|
#if LWIP_SO_SNDTIMEO
|
||||||
|
/** timeout to wait for sending data (which means enqueueing data for sending
|
||||||
|
in internal buffers) in milliseconds */
|
||||||
|
s32_t send_timeout;
|
||||||
|
#endif /* LWIP_SO_RCVTIMEO */
|
||||||
|
#if LWIP_SO_RCVTIMEO
|
||||||
|
/** timeout in milliseconds to wait for new data to be received
|
||||||
|
(or connections to arrive for listening netconns) */
|
||||||
|
u32_t recv_timeout;
|
||||||
|
#endif /* LWIP_SO_RCVTIMEO */
|
||||||
|
#if LWIP_SO_RCVBUF
|
||||||
|
/** maximum amount of bytes queued in recvmbox
|
||||||
|
not used for TCP: adjust TCP_WND instead! */
|
||||||
|
int recv_bufsize;
|
||||||
|
/** number of bytes currently in recvmbox to be received,
|
||||||
|
tested against recv_bufsize to limit bytes on recvmbox
|
||||||
|
for UDP and RAW, used for FIONREAD */
|
||||||
|
int recv_avail;
|
||||||
|
#endif /* LWIP_SO_RCVBUF */
|
||||||
|
#if LWIP_SO_LINGER
|
||||||
|
/** values <0 mean linger is disabled, values > 0 are seconds to linger */
|
||||||
|
s16_t linger;
|
||||||
|
#endif /* LWIP_SO_LINGER */
|
||||||
|
/** flags holding more netconn-internal state, see NETCONN_FLAG_* defines */
|
||||||
|
u8_t flags;
|
||||||
|
#if LWIP_TCP
|
||||||
|
/** TCP: when data passed to netconn_write doesn't fit into the send buffer,
|
||||||
|
this temporarily stores the message.
|
||||||
|
Also used during connect and close. */
|
||||||
|
struct api_msg *current_msg;
|
||||||
|
#endif /* LWIP_TCP */
|
||||||
|
/** A callback function that is informed about events for this netconn */
|
||||||
|
netconn_callback callback;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** This vector type is passed to @ref netconn_write_vectors_partly to send
|
||||||
|
* multiple buffers at once.
|
||||||
|
* ATTENTION: This type has to directly map struct iovec since one is casted
|
||||||
|
* into the other!
|
||||||
|
*/
|
||||||
|
struct netvector {
|
||||||
|
/** pointer to the application buffer that contains the data to send */
|
||||||
|
const void *ptr;
|
||||||
|
/** size of the application data to send */
|
||||||
|
size_t len;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Register an Network connection event */
|
||||||
|
#define API_EVENT(c,e,l) if (c->callback) { \
|
||||||
|
(*c->callback)(c, e, l); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Network connection functions: */
|
||||||
|
|
||||||
|
/** @ingroup netconn_common
|
||||||
|
* Create new netconn connection
|
||||||
|
* @param t @ref netconn_type */
|
||||||
|
#define netconn_new(t) netconn_new_with_proto_and_callback(t, 0, NULL)
|
||||||
|
#define netconn_new_with_callback(t, c) netconn_new_with_proto_and_callback(t, 0, c)
|
||||||
|
struct netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u8_t proto,
|
||||||
|
netconn_callback callback);
|
||||||
|
err_t netconn_prepare_delete(struct netconn *conn);
|
||||||
|
err_t netconn_delete(struct netconn *conn);
|
||||||
|
/** Get the type of a netconn (as enum netconn_type). */
|
||||||
|
#define netconn_type(conn) (conn->type)
|
||||||
|
|
||||||
|
err_t netconn_getaddr(struct netconn *conn, ip_addr_t *addr,
|
||||||
|
u16_t *port, u8_t local);
|
||||||
|
/** @ingroup netconn_common */
|
||||||
|
#define netconn_peer(c,i,p) netconn_getaddr(c,i,p,0)
|
||||||
|
/** @ingroup netconn_common */
|
||||||
|
#define netconn_addr(c,i,p) netconn_getaddr(c,i,p,1)
|
||||||
|
|
||||||
|
err_t netconn_bind(struct netconn *conn, const ip_addr_t *addr, u16_t port);
|
||||||
|
err_t netconn_bind_if(struct netconn *conn, u8_t if_idx);
|
||||||
|
err_t netconn_connect(struct netconn *conn, const ip_addr_t *addr, u16_t port);
|
||||||
|
err_t netconn_disconnect (struct netconn *conn);
|
||||||
|
err_t netconn_listen_with_backlog(struct netconn *conn, u8_t backlog);
|
||||||
|
/** @ingroup netconn_tcp */
|
||||||
|
#define netconn_listen(conn) netconn_listen_with_backlog(conn, TCP_DEFAULT_LISTEN_BACKLOG)
|
||||||
|
err_t netconn_accept(struct netconn *conn, struct netconn **new_conn);
|
||||||
|
err_t netconn_recv(struct netconn *conn, struct netbuf **new_buf);
|
||||||
|
err_t netconn_recv_udp_raw_netbuf(struct netconn *conn, struct netbuf **new_buf);
|
||||||
|
err_t netconn_recv_udp_raw_netbuf_flags(struct netconn *conn, struct netbuf **new_buf, u8_t apiflags);
|
||||||
|
err_t netconn_recv_tcp_pbuf(struct netconn *conn, struct pbuf **new_buf);
|
||||||
|
err_t netconn_recv_tcp_pbuf_flags(struct netconn *conn, struct pbuf **new_buf, u8_t apiflags);
|
||||||
|
err_t netconn_tcp_recvd(struct netconn *conn, size_t len);
|
||||||
|
err_t netconn_sendto(struct netconn *conn, struct netbuf *buf,
|
||||||
|
const ip_addr_t *addr, u16_t port);
|
||||||
|
err_t netconn_send(struct netconn *conn, struct netbuf *buf);
|
||||||
|
err_t netconn_write_partly(struct netconn *conn, const void *dataptr, size_t size,
|
||||||
|
u8_t apiflags, size_t *bytes_written);
|
||||||
|
err_t netconn_write_vectors_partly(struct netconn *conn, struct netvector *vectors, u16_t vectorcnt,
|
||||||
|
u8_t apiflags, size_t *bytes_written);
|
||||||
|
/** @ingroup netconn_tcp */
|
||||||
|
#define netconn_write(conn, dataptr, size, apiflags) \
|
||||||
|
netconn_write_partly(conn, dataptr, size, apiflags, NULL)
|
||||||
|
err_t netconn_close(struct netconn *conn);
|
||||||
|
err_t netconn_shutdown(struct netconn *conn, u8_t shut_rx, u8_t shut_tx);
|
||||||
|
|
||||||
|
#if LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD)
|
||||||
|
err_t netconn_join_leave_group(struct netconn *conn, const ip_addr_t *multiaddr,
|
||||||
|
const ip_addr_t *netif_addr, enum netconn_igmp join_or_leave);
|
||||||
|
err_t netconn_join_leave_group_netif(struct netconn *conn, const ip_addr_t *multiaddr,
|
||||||
|
u8_t if_idx, enum netconn_igmp join_or_leave);
|
||||||
|
#endif /* LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD) */
|
||||||
|
#if LWIP_DNS
|
||||||
|
#if LWIP_IPV4 && LWIP_IPV6
|
||||||
|
err_t netconn_gethostbyname_addrtype(const char *name, ip_addr_t *addr, u8_t dns_addrtype);
|
||||||
|
#define netconn_gethostbyname(name, addr) netconn_gethostbyname_addrtype(name, addr, NETCONN_DNS_DEFAULT)
|
||||||
|
#else /* LWIP_IPV4 && LWIP_IPV6 */
|
||||||
|
err_t netconn_gethostbyname(const char *name, ip_addr_t *addr);
|
||||||
|
#define netconn_gethostbyname_addrtype(name, addr, dns_addrtype) netconn_gethostbyname(name, addr)
|
||||||
|
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||||
|
#endif /* LWIP_DNS */
|
||||||
|
|
||||||
|
err_t netconn_err(struct netconn *conn);
|
||||||
|
#define netconn_recv_bufsize(conn) ((conn)->recv_bufsize)
|
||||||
|
|
||||||
|
#define netconn_set_flags(conn, set_flags) do { (conn)->flags = (u8_t)((conn)->flags | (set_flags)); } while(0)
|
||||||
|
#define netconn_clear_flags(conn, clr_flags) do { (conn)->flags = (u8_t)((conn)->flags & (u8_t)(~(clr_flags) & 0xff)); } while(0)
|
||||||
|
#define netconn_is_flag_set(conn, flag) (((conn)->flags & (flag)) != 0)
|
||||||
|
|
||||||
|
/** Set the blocking status of netconn calls (@todo: write/send is missing) */
|
||||||
|
#define netconn_set_nonblocking(conn, val) do { if(val) { \
|
||||||
|
netconn_set_flags(conn, NETCONN_FLAG_NON_BLOCKING); \
|
||||||
|
} else { \
|
||||||
|
netconn_clear_flags(conn, NETCONN_FLAG_NON_BLOCKING); }} while(0)
|
||||||
|
/** Get the blocking status of netconn calls (@todo: write/send is missing) */
|
||||||
|
#define netconn_is_nonblocking(conn) (((conn)->flags & NETCONN_FLAG_NON_BLOCKING) != 0)
|
||||||
|
|
||||||
|
#if LWIP_IPV6
|
||||||
|
/** @ingroup netconn_common
|
||||||
|
* TCP: Set the IPv6 ONLY status of netconn calls (see NETCONN_FLAG_IPV6_V6ONLY)
|
||||||
|
*/
|
||||||
|
#define netconn_set_ipv6only(conn, val) do { if(val) { \
|
||||||
|
netconn_set_flags(conn, NETCONN_FLAG_IPV6_V6ONLY); \
|
||||||
|
} else { \
|
||||||
|
netconn_clear_flags(conn, NETCONN_FLAG_IPV6_V6ONLY); }} while(0)
|
||||||
|
/** @ingroup netconn_common
|
||||||
|
* TCP: Get the IPv6 ONLY status of netconn calls (see NETCONN_FLAG_IPV6_V6ONLY)
|
||||||
|
*/
|
||||||
|
#define netconn_get_ipv6only(conn) (((conn)->flags & NETCONN_FLAG_IPV6_V6ONLY) != 0)
|
||||||
|
#endif /* LWIP_IPV6 */
|
||||||
|
|
||||||
|
#if LWIP_SO_SNDTIMEO
|
||||||
|
/** Set the send timeout in milliseconds */
|
||||||
|
#define netconn_set_sendtimeout(conn, timeout) ((conn)->send_timeout = (timeout))
|
||||||
|
/** Get the send timeout in milliseconds */
|
||||||
|
#define netconn_get_sendtimeout(conn) ((conn)->send_timeout)
|
||||||
|
#endif /* LWIP_SO_SNDTIMEO */
|
||||||
|
#if LWIP_SO_RCVTIMEO
|
||||||
|
/** Set the receive timeout in milliseconds */
|
||||||
|
#define netconn_set_recvtimeout(conn, timeout) ((conn)->recv_timeout = (timeout))
|
||||||
|
/** Get the receive timeout in milliseconds */
|
||||||
|
#define netconn_get_recvtimeout(conn) ((conn)->recv_timeout)
|
||||||
|
#endif /* LWIP_SO_RCVTIMEO */
|
||||||
|
#if LWIP_SO_RCVBUF
|
||||||
|
/** Set the receive buffer in bytes */
|
||||||
|
#define netconn_set_recvbufsize(conn, recvbufsize) ((conn)->recv_bufsize = (recvbufsize))
|
||||||
|
/** Get the receive buffer in bytes */
|
||||||
|
#define netconn_get_recvbufsize(conn) ((conn)->recv_bufsize)
|
||||||
|
#endif /* LWIP_SO_RCVBUF*/
|
||||||
|
|
||||||
|
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||||
|
void netconn_thread_init(void);
|
||||||
|
void netconn_thread_cleanup(void);
|
||||||
|
#else /* LWIP_NETCONN_SEM_PER_THREAD */
|
||||||
|
#define netconn_thread_init()
|
||||||
|
#define netconn_thread_cleanup()
|
||||||
|
#endif /* LWIP_NETCONN_SEM_PER_THREAD */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_NETCONN || LWIP_SOCKET */
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_API_H */
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
This directory contains application headers.
|
||||||
|
Every application shall provide one api file APP.h and optionally one options file APP_opts.h
|
||||||
+79
@@ -0,0 +1,79 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Application layered TCP connection API that executes a proxy-connect.
|
||||||
|
*
|
||||||
|
* This file provides a starting layer that executes a proxy-connect e.g. to
|
||||||
|
* set up TLS connections through a http proxy.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Simon Goldschmidt
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Simon Goldschmidt <goldsimon@gmx.de>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_APPS_ALTCP_PROXYCONNECT_H
|
||||||
|
#define LWIP_HDR_APPS_ALTCP_PROXYCONNECT_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
#include "lwip/ip_addr.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct altcp_proxyconnect_config {
|
||||||
|
ip_addr_t proxy_addr;
|
||||||
|
u16_t proxy_port;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct altcp_pcb *altcp_proxyconnect_new(struct altcp_proxyconnect_config *config, struct altcp_pcb *inner_pcb);
|
||||||
|
struct altcp_pcb *altcp_proxyconnect_new_tcp(struct altcp_proxyconnect_config *config, u8_t ip_type);
|
||||||
|
|
||||||
|
struct altcp_pcb *altcp_proxyconnect_alloc(void *arg, u8_t ip_type);
|
||||||
|
|
||||||
|
#if LWIP_ALTCP_TLS
|
||||||
|
struct altcp_proxyconnect_tls_config {
|
||||||
|
struct altcp_proxyconnect_config proxy;
|
||||||
|
struct altcp_tls_config *tls_config;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct altcp_pcb *altcp_proxyconnect_tls_alloc(void *arg, u8_t ip_type);
|
||||||
|
#endif /* LWIP_ALTCP_TLS */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_ALTCP */
|
||||||
|
#endif /* LWIP_HDR_APPS_ALTCP_PROXYCONNECT_H */
|
||||||
+105
@@ -0,0 +1,105 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Application layered TCP/TLS connection API (to be used from TCPIP thread)
|
||||||
|
*
|
||||||
|
* This file contains options for an mbedtls port of the TLS layer.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2017 Simon Goldschmidt
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Simon Goldschmidt <goldsimon@gmx.de>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_ALTCP_TLS_OPTS_H
|
||||||
|
#define LWIP_HDR_ALTCP_TLS_OPTS_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
/** LWIP_ALTCP_TLS_MBEDTLS==1: use mbedTLS for TLS support for altcp API
|
||||||
|
* mbedtls include directory must be reachable via include search path
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_ALTCP_TLS_MBEDTLS
|
||||||
|
#define LWIP_ALTCP_TLS_MBEDTLS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Configure debug level of this file */
|
||||||
|
#ifndef ALTCP_MBEDTLS_DEBUG
|
||||||
|
#define ALTCP_MBEDTLS_DEBUG LWIP_DBG_OFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Configure lwIP debug level of the mbedTLS library */
|
||||||
|
#ifndef ALTCP_MBEDTLS_LIB_DEBUG
|
||||||
|
#define ALTCP_MBEDTLS_LIB_DEBUG LWIP_DBG_OFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Configure minimum internal debug level of the mbedTLS library */
|
||||||
|
#ifndef ALTCP_MBEDTLS_LIB_DEBUG_LEVEL_MIN
|
||||||
|
#define ALTCP_MBEDTLS_LIB_DEBUG_LEVEL_MIN 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Enable the basic session cache
|
||||||
|
* ATTENTION: Using a session cache can lower security by reusing keys!
|
||||||
|
*/
|
||||||
|
#ifndef ALTCP_MBEDTLS_USE_SESSION_CACHE
|
||||||
|
#define ALTCP_MBEDTLS_USE_SESSION_CACHE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Maximum cache size of the basic session cache */
|
||||||
|
#ifndef ALTCP_MBEDTLS_SESSION_CACHE_SIZE
|
||||||
|
#define ALTCP_MBEDTLS_SESSION_CACHE_SIZE 30
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set a session timeout in seconds for the basic session cache */
|
||||||
|
#ifndef ALTCP_MBEDTLS_SESSION_CACHE_TIMEOUT_SECONDS
|
||||||
|
#define ALTCP_MBEDTLS_SESSION_CACHE_TIMEOUT_SECONDS (60 * 60)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Use session tickets to speed up connection setup (needs
|
||||||
|
* MBEDTLS_SSL_SESSION_TICKETS enabled in mbedTLS config).
|
||||||
|
* ATTENTION: Using session tickets can lower security by reusing keys!
|
||||||
|
*/
|
||||||
|
#ifndef ALTCP_MBEDTLS_USE_SESSION_TICKETS
|
||||||
|
#define ALTCP_MBEDTLS_USE_SESSION_TICKETS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Session ticket cipher */
|
||||||
|
#ifndef ALTCP_MBEDTLS_SESSION_TICKET_CIPHER
|
||||||
|
#define ALTCP_MBEDTLS_SESSION_TICKET_CIPHER MBEDTLS_CIPHER_AES_256_GCM
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Maximum timeout for session tickets */
|
||||||
|
#ifndef ALTCP_MBEDTLS_SESSION_TICKET_TIMEOUT_SECONDS
|
||||||
|
#define ALTCP_MBEDTLS_SESSION_TICKET_TIMEOUT_SECONDS (60 * 60 * 24)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_ALTCP */
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_ALTCP_TLS_OPTS_H */
|
||||||
+126
@@ -0,0 +1,126 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_APPS_FS_H
|
||||||
|
#define LWIP_HDR_APPS_FS_H
|
||||||
|
|
||||||
|
#include "httpd_opts.h"
|
||||||
|
#include "lwip/err.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define FS_READ_EOF -1
|
||||||
|
#define FS_READ_DELAYED -2
|
||||||
|
|
||||||
|
#if HTTPD_PRECALCULATED_CHECKSUM
|
||||||
|
struct fsdata_chksum {
|
||||||
|
u32_t offset;
|
||||||
|
u16_t chksum;
|
||||||
|
u16_t len;
|
||||||
|
};
|
||||||
|
#endif /* HTTPD_PRECALCULATED_CHECKSUM */
|
||||||
|
|
||||||
|
#define FS_FILE_FLAGS_HEADER_INCLUDED 0x01
|
||||||
|
#define FS_FILE_FLAGS_HEADER_PERSISTENT 0x02
|
||||||
|
#define FS_FILE_FLAGS_HEADER_HTTPVER_1_1 0x04
|
||||||
|
#define FS_FILE_FLAGS_SSI 0x08
|
||||||
|
|
||||||
|
/** Define FS_FILE_EXTENSION_T_DEFINED if you have typedef'ed to your private
|
||||||
|
* pointer type (defaults to 'void' so the default usage is 'void*')
|
||||||
|
*/
|
||||||
|
#ifndef FS_FILE_EXTENSION_T_DEFINED
|
||||||
|
typedef void fs_file_extension;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct fs_file {
|
||||||
|
const char *data;
|
||||||
|
int len;
|
||||||
|
int index;
|
||||||
|
/* pextension is free for implementations to hold private (extensional)
|
||||||
|
arbitrary data, e.g. holding some file state or file system handle */
|
||||||
|
fs_file_extension *pextension;
|
||||||
|
#if HTTPD_PRECALCULATED_CHECKSUM
|
||||||
|
const struct fsdata_chksum *chksum;
|
||||||
|
u16_t chksum_count;
|
||||||
|
#endif /* HTTPD_PRECALCULATED_CHECKSUM */
|
||||||
|
u8_t flags;
|
||||||
|
#if LWIP_HTTPD_CUSTOM_FILES
|
||||||
|
u8_t is_custom_file;
|
||||||
|
#endif /* LWIP_HTTPD_CUSTOM_FILES */
|
||||||
|
#if LWIP_HTTPD_FILE_STATE
|
||||||
|
void *state;
|
||||||
|
#endif /* LWIP_HTTPD_FILE_STATE */
|
||||||
|
};
|
||||||
|
|
||||||
|
#if LWIP_HTTPD_FS_ASYNC_READ
|
||||||
|
typedef void (*fs_wait_cb)(void *arg);
|
||||||
|
#endif /* LWIP_HTTPD_FS_ASYNC_READ */
|
||||||
|
|
||||||
|
err_t fs_open(struct fs_file *file, const char *name);
|
||||||
|
void fs_close(struct fs_file *file);
|
||||||
|
#if LWIP_HTTPD_DYNAMIC_FILE_READ
|
||||||
|
#if LWIP_HTTPD_FS_ASYNC_READ
|
||||||
|
int fs_read_async(struct fs_file *file, char *buffer, int count, fs_wait_cb callback_fn, void *callback_arg);
|
||||||
|
#else /* LWIP_HTTPD_FS_ASYNC_READ */
|
||||||
|
int fs_read(struct fs_file *file, char *buffer, int count);
|
||||||
|
#endif /* LWIP_HTTPD_FS_ASYNC_READ */
|
||||||
|
#endif /* LWIP_HTTPD_DYNAMIC_FILE_READ */
|
||||||
|
#if LWIP_HTTPD_FS_ASYNC_READ
|
||||||
|
int fs_is_file_ready(struct fs_file *file, fs_wait_cb callback_fn, void *callback_arg);
|
||||||
|
#endif /* LWIP_HTTPD_FS_ASYNC_READ */
|
||||||
|
int fs_bytes_left(struct fs_file *file);
|
||||||
|
|
||||||
|
#if LWIP_HTTPD_FILE_STATE
|
||||||
|
/** This user-defined function is called when a file is opened. */
|
||||||
|
void *fs_state_init(struct fs_file *file, const char *name);
|
||||||
|
/** This user-defined function is called when a file is closed. */
|
||||||
|
void fs_state_free(struct fs_file *file, void *state);
|
||||||
|
#endif /* #if LWIP_HTTPD_FILE_STATE */
|
||||||
|
|
||||||
|
struct fsdata_file {
|
||||||
|
const struct fsdata_file *next;
|
||||||
|
const unsigned char *name;
|
||||||
|
const unsigned char *data;
|
||||||
|
int len;
|
||||||
|
u8_t flags;
|
||||||
|
#if HTTPD_PRECALCULATED_CHECKSUM
|
||||||
|
u16_t chksum_count;
|
||||||
|
const struct fsdata_chksum *chksum;
|
||||||
|
#endif /* HTTPD_PRECALCULATED_CHECKSUM */
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_FS_H */
|
||||||
+160
@@ -0,0 +1,160 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* HTTP client
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Simon Goldschmidt <goldsimon@gmx.de>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Simon Goldschmidt <goldsimon@gmx.de>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_APPS_HTTP_CLIENT_H
|
||||||
|
#define LWIP_HDR_APPS_HTTP_CLIENT_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
#include "lwip/ip_addr.h"
|
||||||
|
#include "lwip/err.h"
|
||||||
|
#include "lwip/altcp.h"
|
||||||
|
#include "lwip/prot/iana.h"
|
||||||
|
#include "lwip/pbuf.h"
|
||||||
|
|
||||||
|
#if LWIP_TCP && LWIP_CALLBACK_API
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup httpc
|
||||||
|
* HTTPC_HAVE_FILE_IO: define this to 1 to have functions dowloading directly
|
||||||
|
* to disk via fopen/fwrite.
|
||||||
|
* These functions are example implementations of the interface only.
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HTTPC_HAVE_FILE_IO
|
||||||
|
#define LWIP_HTTPC_HAVE_FILE_IO 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup httpc
|
||||||
|
* The default TCP port used for HTTP
|
||||||
|
*/
|
||||||
|
#define HTTP_DEFAULT_PORT LWIP_IANA_PORT_HTTP
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup httpc
|
||||||
|
* HTTP client result codes
|
||||||
|
*/
|
||||||
|
typedef enum ehttpc_result {
|
||||||
|
/** File successfully received */
|
||||||
|
HTTPC_RESULT_OK = 0,
|
||||||
|
/** Unknown error */
|
||||||
|
HTTPC_RESULT_ERR_UNKNOWN = 1,
|
||||||
|
/** Connection to server failed */
|
||||||
|
HTTPC_RESULT_ERR_CONNECT = 2,
|
||||||
|
/** Failed to resolve server hostname */
|
||||||
|
HTTPC_RESULT_ERR_HOSTNAME = 3,
|
||||||
|
/** Connection unexpectedly closed by remote server */
|
||||||
|
HTTPC_RESULT_ERR_CLOSED = 4,
|
||||||
|
/** Connection timed out (server didn't respond in time) */
|
||||||
|
HTTPC_RESULT_ERR_TIMEOUT = 5,
|
||||||
|
/** Server responded with an error code */
|
||||||
|
HTTPC_RESULT_ERR_SVR_RESP = 6,
|
||||||
|
/** Local memory error */
|
||||||
|
HTTPC_RESULT_ERR_MEM = 7,
|
||||||
|
/** Local abort */
|
||||||
|
HTTPC_RESULT_LOCAL_ABORT = 8,
|
||||||
|
/** Content length mismatch */
|
||||||
|
HTTPC_RESULT_ERR_CONTENT_LEN = 9
|
||||||
|
} httpc_result_t;
|
||||||
|
|
||||||
|
typedef struct _httpc_state httpc_state_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup httpc
|
||||||
|
* Prototype of a http client callback function
|
||||||
|
*
|
||||||
|
* @param arg argument specified when initiating the request
|
||||||
|
* @param httpc_result result of the http transfer (see enum httpc_result_t)
|
||||||
|
* @param rx_content_len number of bytes received (without headers)
|
||||||
|
* @param srv_res this contains the http status code received (if any)
|
||||||
|
* @param err an error returned by internal lwip functions, can help to specify
|
||||||
|
* the source of the error but must not necessarily be != ERR_OK
|
||||||
|
*/
|
||||||
|
typedef void (*httpc_result_fn)(void *arg, httpc_result_t httpc_result, u32_t rx_content_len, u32_t srv_res, err_t err);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup httpc
|
||||||
|
* Prototype of http client callback: called when the headers are received
|
||||||
|
*
|
||||||
|
* @param connection http client connection
|
||||||
|
* @param arg argument specified when initiating the request
|
||||||
|
* @param hdr header pbuf(s) (may contain data also)
|
||||||
|
* @param hdr_len length of the heders in 'hdr'
|
||||||
|
* @param content_len content length as received in the headers (-1 if not received)
|
||||||
|
* @return if != ERR_OK is returned, the connection is aborted
|
||||||
|
*/
|
||||||
|
typedef err_t (*httpc_headers_done_fn)(httpc_state_t *connection, void *arg, struct pbuf *hdr, u16_t hdr_len, u32_t content_len);
|
||||||
|
|
||||||
|
typedef struct _httpc_connection {
|
||||||
|
ip_addr_t proxy_addr;
|
||||||
|
u16_t proxy_port;
|
||||||
|
u8_t use_proxy;
|
||||||
|
/* @todo: add username:pass? */
|
||||||
|
|
||||||
|
#if LWIP_ALTCP
|
||||||
|
altcp_allocator_t *altcp_allocator;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* this callback is called when the transfer is finished (or aborted) */
|
||||||
|
httpc_result_fn result_fn;
|
||||||
|
/* this callback is called after receiving the http headers
|
||||||
|
It can abort the connection by returning != ERR_OK */
|
||||||
|
httpc_headers_done_fn headers_done_fn;
|
||||||
|
} httpc_connection_t;
|
||||||
|
|
||||||
|
err_t httpc_get_file(const ip_addr_t* server_addr, u16_t port, const char* uri, const httpc_connection_t *settings,
|
||||||
|
altcp_recv_fn recv_fn, void* callback_arg, httpc_state_t **connection);
|
||||||
|
err_t httpc_get_file_dns(const char* server_name, u16_t port, const char* uri, const httpc_connection_t *settings,
|
||||||
|
altcp_recv_fn recv_fn, void* callback_arg, httpc_state_t **connection);
|
||||||
|
|
||||||
|
#if LWIP_HTTPC_HAVE_FILE_IO
|
||||||
|
err_t httpc_get_file_to_disk(const ip_addr_t* server_addr, u16_t port, const char* uri, const httpc_connection_t *settings,
|
||||||
|
void* callback_arg, const char* local_file_name, httpc_state_t **connection);
|
||||||
|
err_t httpc_get_file_dns_to_disk(const char* server_name, u16_t port, const char* uri, const httpc_connection_t *settings,
|
||||||
|
void* callback_arg, const char* local_file_name, httpc_state_t **connection);
|
||||||
|
#endif /* LWIP_HTTPC_HAVE_FILE_IO */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_TCP && LWIP_CALLBACK_API */
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_HTTP_CLIENT_H */
|
||||||
+255
@@ -0,0 +1,255 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* HTTP server
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
|
*
|
||||||
|
* This version of the file has been modified by Texas Instruments to offer
|
||||||
|
* simple server-side-include (SSI) and Common Gateway Interface (CGI)
|
||||||
|
* capability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_APPS_HTTPD_H
|
||||||
|
#define LWIP_HDR_APPS_HTTPD_H
|
||||||
|
|
||||||
|
#include "httpd_opts.h"
|
||||||
|
#include "lwip/err.h"
|
||||||
|
#include "lwip/pbuf.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LWIP_HTTPD_CGI
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup httpd
|
||||||
|
* Function pointer for a CGI script handler.
|
||||||
|
*
|
||||||
|
* This function is called each time the HTTPD server is asked for a file
|
||||||
|
* whose name was previously registered as a CGI function using a call to
|
||||||
|
* http_set_cgi_handlers. The iIndex parameter provides the index of the
|
||||||
|
* CGI within the cgis array passed to http_set_cgi_handlers. Parameters
|
||||||
|
* pcParam and pcValue provide access to the parameters provided along with
|
||||||
|
* the URI. iNumParams provides a count of the entries in the pcParam and
|
||||||
|
* pcValue arrays. Each entry in the pcParam array contains the name of a
|
||||||
|
* parameter with the corresponding entry in the pcValue array containing the
|
||||||
|
* value for that parameter. Note that pcParam may contain multiple elements
|
||||||
|
* with the same name if, for example, a multi-selection list control is used
|
||||||
|
* in the form generating the data.
|
||||||
|
*
|
||||||
|
* The function should return a pointer to a character string which is the
|
||||||
|
* path and filename of the response that is to be sent to the connected
|
||||||
|
* browser, for example "/thanks.htm" or "/response/error.ssi".
|
||||||
|
*
|
||||||
|
* The maximum number of parameters that will be passed to this function via
|
||||||
|
* iNumParams is defined by LWIP_HTTPD_MAX_CGI_PARAMETERS. Any parameters in
|
||||||
|
* the incoming HTTP request above this number will be discarded.
|
||||||
|
*
|
||||||
|
* Requests intended for use by this CGI mechanism must be sent using the GET
|
||||||
|
* method (which encodes all parameters within the URI rather than in a block
|
||||||
|
* later in the request). Attempts to use the POST method will result in the
|
||||||
|
* request being ignored.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef const char *(*tCGIHandler)(int iIndex, int iNumParams, char *pcParam[],
|
||||||
|
char *pcValue[]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup httpd
|
||||||
|
* Structure defining the base filename (URL) of a CGI and the associated
|
||||||
|
* function which is to be called when that URL is requested.
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
const char *pcCGIName;
|
||||||
|
tCGIHandler pfnCGIHandler;
|
||||||
|
} tCGI;
|
||||||
|
|
||||||
|
void http_set_cgi_handlers(const tCGI *pCGIs, int iNumHandlers);
|
||||||
|
|
||||||
|
#endif /* LWIP_HTTPD_CGI */
|
||||||
|
|
||||||
|
#if LWIP_HTTPD_CGI || LWIP_HTTPD_CGI_SSI
|
||||||
|
|
||||||
|
#if LWIP_HTTPD_CGI_SSI
|
||||||
|
/* we have to prototype this struct here to make it available for the handler */
|
||||||
|
struct fs_file;
|
||||||
|
|
||||||
|
/** Define this generic CGI handler in your application.
|
||||||
|
* It is called once for every URI with parameters.
|
||||||
|
* The parameters can be stored to the object passed as connection_state, which
|
||||||
|
* is allocated to file->state via fs_state_init() from fs_open() or fs_open_custom().
|
||||||
|
* Content creation via SSI or complete dynamic files can retrieve the CGI params from there.
|
||||||
|
*/
|
||||||
|
extern void httpd_cgi_handler(struct fs_file *file, const char* uri, int iNumParams,
|
||||||
|
char **pcParam, char **pcValue
|
||||||
|
#if defined(LWIP_HTTPD_FILE_STATE) && LWIP_HTTPD_FILE_STATE
|
||||||
|
, void *connection_state
|
||||||
|
#endif /* LWIP_HTTPD_FILE_STATE */
|
||||||
|
);
|
||||||
|
#endif /* LWIP_HTTPD_CGI_SSI */
|
||||||
|
|
||||||
|
#endif /* LWIP_HTTPD_CGI || LWIP_HTTPD_CGI_SSI */
|
||||||
|
|
||||||
|
#if LWIP_HTTPD_SSI
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup httpd
|
||||||
|
* Function pointer for the SSI tag handler callback.
|
||||||
|
*
|
||||||
|
* This function will be called each time the HTTPD server detects a tag of the
|
||||||
|
* form <!--#name--> in files with extensions mentioned in the g_pcSSIExtensions
|
||||||
|
* array (currently .shtml, .shtm, .ssi, .xml, .json) where "name" appears as
|
||||||
|
* one of the tags supplied to http_set_ssi_handler in the tags array. The
|
||||||
|
* returned insert string, which will be appended after the the string
|
||||||
|
* "<!--#name-->" in file sent back to the client, should be written to pointer
|
||||||
|
* pcInsert. iInsertLen contains the size of the buffer pointed to by
|
||||||
|
* pcInsert. The iIndex parameter provides the zero-based index of the tag as
|
||||||
|
* found in the tags array and identifies the tag that is to be processed.
|
||||||
|
*
|
||||||
|
* The handler returns the number of characters written to pcInsert excluding
|
||||||
|
* any terminating NULL or HTTPD_SSI_TAG_UNKNOWN when tag is not recognized.
|
||||||
|
*
|
||||||
|
* Note that the behavior of this SSI mechanism is somewhat different from the
|
||||||
|
* "normal" SSI processing as found in, for example, the Apache web server. In
|
||||||
|
* this case, the inserted text is appended following the SSI tag rather than
|
||||||
|
* replacing the tag entirely. This allows for an implementation that does not
|
||||||
|
* require significant additional buffering of output data yet which will still
|
||||||
|
* offer usable SSI functionality. One downside to this approach is when
|
||||||
|
* attempting to use SSI within JavaScript. The SSI tag is structured to
|
||||||
|
* resemble an HTML comment but this syntax does not constitute a comment
|
||||||
|
* within JavaScript and, hence, leaving the tag in place will result in
|
||||||
|
* problems in these cases. In order to avoid these problems, define
|
||||||
|
* LWIP_HTTPD_SSI_INCLUDE_TAG as zero in your lwip options file, or use JavaScript
|
||||||
|
* style block comments in the form / * # name * / (without the spaces).
|
||||||
|
*/
|
||||||
|
typedef u16_t (*tSSIHandler)(
|
||||||
|
#if LWIP_HTTPD_SSI_RAW
|
||||||
|
const char* ssi_tag_name,
|
||||||
|
#else /* LWIP_HTTPD_SSI_RAW */
|
||||||
|
int iIndex,
|
||||||
|
#endif /* LWIP_HTTPD_SSI_RAW */
|
||||||
|
char *pcInsert, int iInsertLen
|
||||||
|
#if LWIP_HTTPD_SSI_MULTIPART
|
||||||
|
, u16_t current_tag_part, u16_t *next_tag_part
|
||||||
|
#endif /* LWIP_HTTPD_SSI_MULTIPART */
|
||||||
|
#if defined(LWIP_HTTPD_FILE_STATE) && LWIP_HTTPD_FILE_STATE
|
||||||
|
, void *connection_state
|
||||||
|
#endif /* LWIP_HTTPD_FILE_STATE */
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Set the SSI handler function
|
||||||
|
* (if LWIP_HTTPD_SSI_RAW==1, only the first argument is used)
|
||||||
|
*/
|
||||||
|
void http_set_ssi_handler(tSSIHandler pfnSSIHandler,
|
||||||
|
const char **ppcTags, int iNumTags);
|
||||||
|
|
||||||
|
/** For LWIP_HTTPD_SSI_RAW==1, return this to indicate the tag is unknown.
|
||||||
|
* In this case, the webserver writes a warning into the page.
|
||||||
|
* You can also just return 0 to write nothing for unknown tags.
|
||||||
|
*/
|
||||||
|
#define HTTPD_SSI_TAG_UNKNOWN 0xFFFF
|
||||||
|
|
||||||
|
#endif /* LWIP_HTTPD_SSI */
|
||||||
|
|
||||||
|
#if LWIP_HTTPD_SUPPORT_POST
|
||||||
|
|
||||||
|
/* These functions must be implemented by the application */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup httpd
|
||||||
|
* Called when a POST request has been received. The application can decide
|
||||||
|
* whether to accept it or not.
|
||||||
|
*
|
||||||
|
* @param connection Unique connection identifier, valid until httpd_post_end
|
||||||
|
* is called.
|
||||||
|
* @param uri The HTTP header URI receiving the POST request.
|
||||||
|
* @param http_request The raw HTTP request (the first packet, normally).
|
||||||
|
* @param http_request_len Size of 'http_request'.
|
||||||
|
* @param content_len Content-Length from HTTP header.
|
||||||
|
* @param response_uri Filename of response file, to be filled when denying the
|
||||||
|
* request
|
||||||
|
* @param response_uri_len Size of the 'response_uri' buffer.
|
||||||
|
* @param post_auto_wnd Set this to 0 to let the callback code handle window
|
||||||
|
* updates by calling 'httpd_post_data_recved' (to throttle rx speed)
|
||||||
|
* default is 1 (httpd handles window updates automatically)
|
||||||
|
* @return ERR_OK: Accept the POST request, data may be passed in
|
||||||
|
* another err_t: Deny the POST request, send back 'bad request'.
|
||||||
|
*/
|
||||||
|
err_t httpd_post_begin(void *connection, const char *uri, const char *http_request,
|
||||||
|
u16_t http_request_len, int content_len, char *response_uri,
|
||||||
|
u16_t response_uri_len, u8_t *post_auto_wnd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup httpd
|
||||||
|
* Called for each pbuf of data that has been received for a POST.
|
||||||
|
* ATTENTION: The application is responsible for freeing the pbufs passed in!
|
||||||
|
*
|
||||||
|
* @param connection Unique connection identifier.
|
||||||
|
* @param p Received data.
|
||||||
|
* @return ERR_OK: Data accepted.
|
||||||
|
* another err_t: Data denied, http_post_get_response_uri will be called.
|
||||||
|
*/
|
||||||
|
err_t httpd_post_receive_data(void *connection, struct pbuf *p);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup httpd
|
||||||
|
* Called when all data is received or when the connection is closed.
|
||||||
|
* The application must return the filename/URI of a file to send in response
|
||||||
|
* to this POST request. If the response_uri buffer is untouched, a 404
|
||||||
|
* response is returned.
|
||||||
|
*
|
||||||
|
* @param connection Unique connection identifier.
|
||||||
|
* @param response_uri Filename of response file, to be filled when denying the request
|
||||||
|
* @param response_uri_len Size of the 'response_uri' buffer.
|
||||||
|
*/
|
||||||
|
void httpd_post_finished(void *connection, char *response_uri, u16_t response_uri_len);
|
||||||
|
|
||||||
|
#if LWIP_HTTPD_POST_MANUAL_WND
|
||||||
|
void httpd_post_data_recved(void *connection, u16_t recved_len);
|
||||||
|
#endif /* LWIP_HTTPD_POST_MANUAL_WND */
|
||||||
|
|
||||||
|
#endif /* LWIP_HTTPD_SUPPORT_POST */
|
||||||
|
|
||||||
|
void httpd_init(void);
|
||||||
|
|
||||||
|
#if HTTPD_ENABLE_HTTPS
|
||||||
|
struct altcp_tls_config;
|
||||||
|
void httpd_inits(struct altcp_tls_config *conf);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_HTTPD_H */
|
||||||
+396
@@ -0,0 +1,396 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* HTTP server options list
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
|
*
|
||||||
|
* This version of the file has been modified by Texas Instruments to offer
|
||||||
|
* simple server-side-include (SSI) and Common Gateway Interface (CGI)
|
||||||
|
* capability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_APPS_HTTPD_OPTS_H
|
||||||
|
#define LWIP_HDR_APPS_HTTPD_OPTS_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
#include "lwip/prot/iana.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup httpd_opts Options
|
||||||
|
* @ingroup httpd
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Set this to 1 to support CGI (old style).
|
||||||
|
*
|
||||||
|
* This old style CGI support works by registering an array of URLs and
|
||||||
|
* associated CGI handler functions (@ref http_set_cgi_handlers).
|
||||||
|
* This list is scanned just before fs_open is called from request handling.
|
||||||
|
* The handler can return a new URL that is used internally by the httpd to
|
||||||
|
* load the returned page (passed to fs_open).
|
||||||
|
*
|
||||||
|
* Use this CGI type e.g. to execute specific actions and return a page that
|
||||||
|
* does not depend on the CGI parameters.
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_HTTPD_CGI || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_CGI 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to support CGI (new style).
|
||||||
|
*
|
||||||
|
* This new style CGI support works by calling a global function
|
||||||
|
* (@ref tCGIHandler) for all URLs that are found. fs_open is called first
|
||||||
|
* and the URL can not be written by the CGI handler. Instead, this handler gets
|
||||||
|
* passed the http file state, an object where it can store information derived
|
||||||
|
* from the CGI URL or parameters. This file state is later passed to SSI, so
|
||||||
|
* the SSI code can return data depending on CGI input.
|
||||||
|
*
|
||||||
|
* Use this CGI handler if you want CGI information passed on to SSI.
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_HTTPD_CGI_SSI || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_CGI_SSI 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to support SSI (Server-Side-Includes)
|
||||||
|
*
|
||||||
|
* In contrast to other http servers, this only calls a preregistered callback
|
||||||
|
* function (@see http_set_ssi_handler) for each tag (in the format of
|
||||||
|
* <!--#tag-->) encountered in SSI-enabled pages.
|
||||||
|
* SSI-enabled pages must have one of the predefined SSI-enabled file extensions.
|
||||||
|
* All files with one of these extensions are parsed when sent.
|
||||||
|
*
|
||||||
|
* A downside of the current SSI implementation is that persistent connections
|
||||||
|
* don't work, as the file length is not known in advance (and httpd currently
|
||||||
|
* relies on the Content-Length header for persistent connections).
|
||||||
|
*
|
||||||
|
* To save memory, the maximum tag length is limited (@see LWIP_HTTPD_MAX_TAG_NAME_LEN).
|
||||||
|
* To save memory, the maximum insertion string length is limited (@see
|
||||||
|
* LWIP_HTTPD_MAX_TAG_INSERT_LEN). If this is not enough, @ref LWIP_HTTPD_SSI_MULTIPART
|
||||||
|
* can be used.
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_HTTPD_SSI || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_SSI 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to implement an SSI tag handler callback that gets a const char*
|
||||||
|
* to the tag (instead of an index into a pre-registered array of known tags)
|
||||||
|
* If this is 0, the SSI handler callback function is only called pre-registered tags.
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_HTTPD_SSI_RAW || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_SSI_RAW 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 0 to prevent parsing the file extension at runtime to decide
|
||||||
|
* if a file should be scanned for SSI tags or not.
|
||||||
|
* Default is 1 (file extensions are checked using the g_pcSSIExtensions array)
|
||||||
|
* Set to 2 to override this runtime test function.
|
||||||
|
*
|
||||||
|
* This is enabled by default, but if you only use a newer version of makefsdata
|
||||||
|
* supporting the "-ssi" option, this info is already present in
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_HTTPD_SSI_BY_FILE_EXTENSION || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_SSI_BY_FILE_EXTENSION 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to support HTTP POST */
|
||||||
|
#if !defined LWIP_HTTPD_SUPPORT_POST || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_SUPPORT_POST 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The maximum number of parameters that the CGI handler can be sent. */
|
||||||
|
#if !defined LWIP_HTTPD_MAX_CGI_PARAMETERS || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_MAX_CGI_PARAMETERS 16
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** LWIP_HTTPD_SSI_MULTIPART==1: SSI handler function is called with 2 more
|
||||||
|
* arguments indicating a counter for insert string that are too long to be
|
||||||
|
* inserted at once: the SSI handler function must then set 'next_tag_part'
|
||||||
|
* which will be passed back to it in the next call. */
|
||||||
|
#if !defined LWIP_HTTPD_SSI_MULTIPART || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_SSI_MULTIPART 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The maximum length of the string comprising the SSI tag name
|
||||||
|
* ATTENTION: tags longer than this are ignored, not truncated!
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_HTTPD_MAX_TAG_NAME_LEN || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_MAX_TAG_NAME_LEN 8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The maximum length of string that can be returned to replace any given tag
|
||||||
|
* If this buffer is not long enough, use LWIP_HTTPD_SSI_MULTIPART.
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_HTTPD_MAX_TAG_INSERT_LEN || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_MAX_TAG_INSERT_LEN 192
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined LWIP_HTTPD_POST_MANUAL_WND || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_POST_MANUAL_WND 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** This string is passed in the HTTP header as "Server: " */
|
||||||
|
#if !defined HTTPD_SERVER_AGENT || defined __DOXYGEN__
|
||||||
|
#define HTTPD_SERVER_AGENT "lwIP/" LWIP_VERSION_STRING " (http://savannah.nongnu.org/projects/lwip)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 if you want to include code that creates HTTP headers
|
||||||
|
* at runtime. Default is off: HTTP headers are then created statically
|
||||||
|
* by the makefsdata tool. Static headers mean smaller code size, but
|
||||||
|
* the (readonly) fsdata will grow a bit as every file includes the HTTP
|
||||||
|
* header. */
|
||||||
|
#if !defined LWIP_HTTPD_DYNAMIC_HEADERS || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_DYNAMIC_HEADERS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined HTTPD_DEBUG || defined __DOXYGEN__
|
||||||
|
#define HTTPD_DEBUG LWIP_DBG_OFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to use a memp pool for allocating
|
||||||
|
* struct http_state instead of the heap.
|
||||||
|
* If enabled, you'll need to define MEMP_NUM_PARALLEL_HTTPD_CONNS
|
||||||
|
* (and MEMP_NUM_PARALLEL_HTTPD_SSI_CONNS for SSI) to set the size of
|
||||||
|
* the pool(s).
|
||||||
|
*/
|
||||||
|
#if !defined HTTPD_USE_MEM_POOL || defined __DOXYGEN__
|
||||||
|
#define HTTPD_USE_MEM_POOL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** The server port for HTTPD to use */
|
||||||
|
#if !defined HTTPD_SERVER_PORT || defined __DOXYGEN__
|
||||||
|
#define HTTPD_SERVER_PORT LWIP_IANA_PORT_HTTP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** The https server port for HTTPD to use */
|
||||||
|
#if !defined HTTPD_SERVER_PORT_HTTPS || defined __DOXYGEN__
|
||||||
|
#define HTTPD_SERVER_PORT_HTTPS LWIP_IANA_PORT_HTTPS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Enable https support? */
|
||||||
|
#if !defined HTTPD_ENABLE_HTTPS || defined __DOXYGEN__
|
||||||
|
#define HTTPD_ENABLE_HTTPS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Maximum retries before the connection is aborted/closed.
|
||||||
|
* - number of times pcb->poll is called -> default is 4*500ms = 2s;
|
||||||
|
* - reset when pcb->sent is called
|
||||||
|
*/
|
||||||
|
#if !defined HTTPD_MAX_RETRIES || defined __DOXYGEN__
|
||||||
|
#define HTTPD_MAX_RETRIES 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** The poll delay is X*500ms */
|
||||||
|
#if !defined HTTPD_POLL_INTERVAL || defined __DOXYGEN__
|
||||||
|
#define HTTPD_POLL_INTERVAL 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Priority for tcp pcbs created by HTTPD (very low by default).
|
||||||
|
* Lower priorities get killed first when running out of memory.
|
||||||
|
*/
|
||||||
|
#if !defined HTTPD_TCP_PRIO || defined __DOXYGEN__
|
||||||
|
#define HTTPD_TCP_PRIO TCP_PRIO_MIN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to enable timing each file sent */
|
||||||
|
#if !defined LWIP_HTTPD_TIMING || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_TIMING 0
|
||||||
|
#endif
|
||||||
|
/** Set this to 1 to enable timing each file sent */
|
||||||
|
#if !defined HTTPD_DEBUG_TIMING || defined __DOXYGEN__
|
||||||
|
#define HTTPD_DEBUG_TIMING LWIP_DBG_OFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to one to show error pages when parsing a request fails instead
|
||||||
|
of simply closing the connection. */
|
||||||
|
#if !defined LWIP_HTTPD_SUPPORT_EXTSTATUS || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_SUPPORT_EXTSTATUS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 0 to drop support for HTTP/0.9 clients (to save some bytes) */
|
||||||
|
#if !defined LWIP_HTTPD_SUPPORT_V09 || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_SUPPORT_V09 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to enable HTTP/1.1 persistent connections.
|
||||||
|
* ATTENTION: If the generated file system includes HTTP headers, these must
|
||||||
|
* include the "Connection: keep-alive" header (pass argument "-11" to makefsdata).
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_HTTPD_SUPPORT_11_KEEPALIVE || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_SUPPORT_11_KEEPALIVE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to support HTTP request coming in in multiple packets/pbufs */
|
||||||
|
#if !defined LWIP_HTTPD_SUPPORT_REQUESTLIST || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_SUPPORT_REQUESTLIST 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LWIP_HTTPD_SUPPORT_REQUESTLIST
|
||||||
|
/** Number of rx pbufs to enqueue to parse an incoming request (up to the first
|
||||||
|
newline) */
|
||||||
|
#if !defined LWIP_HTTPD_REQ_QUEUELEN || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_REQ_QUEUELEN 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Number of (TCP payload-) bytes (in pbufs) to enqueue to parse and incoming
|
||||||
|
request (up to the first double-newline) */
|
||||||
|
#if !defined LWIP_HTTPD_REQ_BUFSIZE || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_REQ_BUFSIZE LWIP_HTTPD_MAX_REQ_LENGTH
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Defines the maximum length of a HTTP request line (up to the first CRLF,
|
||||||
|
copied from pbuf into this a global buffer when pbuf- or packet-queues
|
||||||
|
are received - otherwise the input pbuf is used directly) */
|
||||||
|
#if !defined LWIP_HTTPD_MAX_REQ_LENGTH || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_MAX_REQ_LENGTH LWIP_MIN(1023, (LWIP_HTTPD_REQ_QUEUELEN * PBUF_POOL_BUFSIZE))
|
||||||
|
#endif
|
||||||
|
#endif /* LWIP_HTTPD_SUPPORT_REQUESTLIST */
|
||||||
|
|
||||||
|
/** This is the size of a static buffer used when URIs end with '/'.
|
||||||
|
* In this buffer, the directory requested is concatenated with all the
|
||||||
|
* configured default file names.
|
||||||
|
* Set to 0 to disable checking default filenames on non-root directories.
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_HTTPD_MAX_REQUEST_URI_LEN || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_MAX_REQUEST_URI_LEN 63
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Maximum length of the filename to send as response to a POST request,
|
||||||
|
* filled in by the application when a POST is finished.
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_HTTPD_POST_MAX_RESPONSE_URI_LEN || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_POST_MAX_RESPONSE_URI_LEN 63
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 0 to not send the SSI tag (default is on, so the tag will
|
||||||
|
* be sent in the HTML page */
|
||||||
|
#if !defined LWIP_HTTPD_SSI_INCLUDE_TAG || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_SSI_INCLUDE_TAG 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to call tcp_abort when tcp_close fails with memory error.
|
||||||
|
* This can be used to prevent consuming all memory in situations where the
|
||||||
|
* HTTP server has low priority compared to other communication. */
|
||||||
|
#if !defined LWIP_HTTPD_ABORT_ON_CLOSE_MEM_ERROR || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_ABORT_ON_CLOSE_MEM_ERROR 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to kill the oldest connection when running out of
|
||||||
|
* memory for 'struct http_state' or 'struct http_ssi_state'.
|
||||||
|
* ATTENTION: This puts all connections on a linked list, so may be kind of slow.
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to send URIs without extension without headers
|
||||||
|
* (who uses this at all??) */
|
||||||
|
#if !defined LWIP_HTTPD_OMIT_HEADER_FOR_EXTENSIONLESS_URI || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_OMIT_HEADER_FOR_EXTENSIONLESS_URI 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Default: Tags are sent from struct http_state and are therefore volatile */
|
||||||
|
#if !defined HTTP_IS_TAG_VOLATILE || defined __DOXYGEN__
|
||||||
|
#define HTTP_IS_TAG_VOLATILE(ptr) TCP_WRITE_FLAG_COPY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* By default, the httpd is limited to send 2*pcb->mss to keep resource usage low
|
||||||
|
when http is not an important protocol in the device. */
|
||||||
|
#if !defined HTTPD_LIMIT_SENDING_TO_2MSS || defined __DOXYGEN__
|
||||||
|
#define HTTPD_LIMIT_SENDING_TO_2MSS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define this to a function that returns the maximum amount of data to enqueue.
|
||||||
|
The function have this signature: u16_t fn(struct altcp_pcb* pcb);
|
||||||
|
The best place to define this is the hooks file (@see LWIP_HOOK_FILENAME) */
|
||||||
|
#if !defined HTTPD_MAX_WRITE_LEN || defined __DOXYGEN__
|
||||||
|
#if HTTPD_LIMIT_SENDING_TO_2MSS
|
||||||
|
#define HTTPD_MAX_WRITE_LEN(pcb) ((u16_t)(2 * altcp_mss(pcb)))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*------------------- FS OPTIONS -------------------*/
|
||||||
|
|
||||||
|
/** Set this to 1 and provide the functions:
|
||||||
|
* - "int fs_open_custom(struct fs_file *file, const char *name)"
|
||||||
|
* Called first for every opened file to allow opening files
|
||||||
|
* that are not included in fsdata(_custom).c
|
||||||
|
* - "void fs_close_custom(struct fs_file *file)"
|
||||||
|
* Called to free resources allocated by fs_open_custom().
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_HTTPD_CUSTOM_FILES || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_CUSTOM_FILES 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to support fs_read() to dynamically read file data.
|
||||||
|
* Without this (default=off), only one-block files are supported,
|
||||||
|
* and the contents must be ready after fs_open().
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_HTTPD_DYNAMIC_FILE_READ || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_DYNAMIC_FILE_READ 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to include an application state argument per file
|
||||||
|
* that is opened. This allows to keep a state per connection/file.
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_HTTPD_FILE_STATE || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_FILE_STATE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** HTTPD_PRECALCULATED_CHECKSUM==1: include precompiled checksums for
|
||||||
|
* predefined (MSS-sized) chunks of the files to prevent having to calculate
|
||||||
|
* the checksums at runtime. */
|
||||||
|
#if !defined HTTPD_PRECALCULATED_CHECKSUM || defined __DOXYGEN__
|
||||||
|
#define HTTPD_PRECALCULATED_CHECKSUM 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** LWIP_HTTPD_FS_ASYNC_READ==1: support asynchronous read operations
|
||||||
|
* (fs_read_async returns FS_READ_DELAYED and calls a callback when finished).
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_HTTPD_FS_ASYNC_READ || defined __DOXYGEN__
|
||||||
|
#define LWIP_HTTPD_FS_ASYNC_READ 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Filename (including path) to use as FS data file */
|
||||||
|
#if !defined HTTPD_FSDATA_FILE || defined __DOXYGEN__
|
||||||
|
/* HTTPD_USE_CUSTOM_FSDATA: Compatibility with deprecated lwIP option */
|
||||||
|
#if defined(HTTPD_USE_CUSTOM_FSDATA) && (HTTPD_USE_CUSTOM_FSDATA != 0)
|
||||||
|
#define HTTPD_FSDATA_FILE "fsdata_custom.c"
|
||||||
|
#else
|
||||||
|
#define HTTPD_FSDATA_FILE "fsdata.c"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_HTTPD_OPTS_H */
|
||||||
+100
@@ -0,0 +1,100 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* lwIP iPerf server implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014 Simon Goldschmidt
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Simon Goldschmidt
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_APPS_LWIPERF_H
|
||||||
|
#define LWIP_HDR_APPS_LWIPERF_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
#include "lwip/ip_addr.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define LWIPERF_TCP_PORT_DEFAULT 5001
|
||||||
|
|
||||||
|
/** lwIPerf test results */
|
||||||
|
enum lwiperf_report_type
|
||||||
|
{
|
||||||
|
/** The server side test is done */
|
||||||
|
LWIPERF_TCP_DONE_SERVER,
|
||||||
|
/** The client side test is done */
|
||||||
|
LWIPERF_TCP_DONE_CLIENT,
|
||||||
|
/** Local error lead to test abort */
|
||||||
|
LWIPERF_TCP_ABORTED_LOCAL,
|
||||||
|
/** Data check error lead to test abort */
|
||||||
|
LWIPERF_TCP_ABORTED_LOCAL_DATAERROR,
|
||||||
|
/** Transmit error lead to test abort */
|
||||||
|
LWIPERF_TCP_ABORTED_LOCAL_TXERROR,
|
||||||
|
/** Remote side aborted the test */
|
||||||
|
LWIPERF_TCP_ABORTED_REMOTE
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Control */
|
||||||
|
enum lwiperf_client_type
|
||||||
|
{
|
||||||
|
/** Unidirectional tx only test */
|
||||||
|
LWIPERF_CLIENT,
|
||||||
|
/** Do a bidirectional test simultaneously */
|
||||||
|
LWIPERF_DUAL,
|
||||||
|
/** Do a bidirectional test individually */
|
||||||
|
LWIPERF_TRADEOFF
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Prototype of a report function that is called when a session is finished.
|
||||||
|
This report function can show the test results.
|
||||||
|
@param report_type contains the test result */
|
||||||
|
typedef void (*lwiperf_report_fn)(void *arg, enum lwiperf_report_type report_type,
|
||||||
|
const ip_addr_t* local_addr, u16_t local_port, const ip_addr_t* remote_addr, u16_t remote_port,
|
||||||
|
u32_t bytes_transferred, u32_t ms_duration, u32_t bandwidth_kbitpsec);
|
||||||
|
|
||||||
|
void* lwiperf_start_tcp_server(const ip_addr_t* local_addr, u16_t local_port,
|
||||||
|
lwiperf_report_fn report_fn, void* report_arg);
|
||||||
|
void* lwiperf_start_tcp_server_default(lwiperf_report_fn report_fn, void* report_arg);
|
||||||
|
void* lwiperf_start_tcp_client(const ip_addr_t* remote_addr, u16_t remote_port,
|
||||||
|
enum lwiperf_client_type type,
|
||||||
|
lwiperf_report_fn report_fn, void* report_arg);
|
||||||
|
void* lwiperf_start_tcp_client_default(const ip_addr_t* remote_addr,
|
||||||
|
lwiperf_report_fn report_fn, void* report_arg);
|
||||||
|
|
||||||
|
void lwiperf_abort(void* lwiperf_session);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_LWIPERF_H */
|
||||||
+105
@@ -0,0 +1,105 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* MDNS responder
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 Verisure Innovation AB
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Erik Ekman <erik@kryo.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_APPS_MDNS_H
|
||||||
|
#define LWIP_HDR_APPS_MDNS_H
|
||||||
|
|
||||||
|
#include "lwip/apps/mdns_opts.h"
|
||||||
|
#include "lwip/netif.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LWIP_MDNS_RESPONDER
|
||||||
|
|
||||||
|
enum mdns_sd_proto {
|
||||||
|
DNSSD_PROTO_UDP = 0,
|
||||||
|
DNSSD_PROTO_TCP = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MDNS_PROBING_CONFLICT 0
|
||||||
|
#define MDNS_PROBING_SUCCESSFUL 1
|
||||||
|
|
||||||
|
#define MDNS_LABEL_MAXLEN 63
|
||||||
|
|
||||||
|
struct mdns_host;
|
||||||
|
struct mdns_service;
|
||||||
|
|
||||||
|
/** Callback function to add text to a reply, called when generating the reply */
|
||||||
|
typedef void (*service_get_txt_fn_t)(struct mdns_service *service, void *txt_userdata);
|
||||||
|
|
||||||
|
/** Callback function to let application know the result of probing network for name
|
||||||
|
* uniqueness, called with result MDNS_PROBING_SUCCESSFUL if no other node claimed
|
||||||
|
* use for the name for the netif or a service and is safe to use, or MDNS_PROBING_CONFLICT
|
||||||
|
* if another node is already using it and mdns is disabled on this interface */
|
||||||
|
typedef void (*mdns_name_result_cb_t)(struct netif* netif, u8_t result);
|
||||||
|
|
||||||
|
void mdns_resp_init(void);
|
||||||
|
|
||||||
|
void mdns_resp_register_name_result_cb(mdns_name_result_cb_t cb);
|
||||||
|
|
||||||
|
err_t mdns_resp_add_netif(struct netif *netif, const char *hostname, u32_t dns_ttl);
|
||||||
|
err_t mdns_resp_remove_netif(struct netif *netif);
|
||||||
|
err_t mdns_resp_rename_netif(struct netif *netif, const char *hostname);
|
||||||
|
|
||||||
|
s8_t mdns_resp_add_service(struct netif *netif, const char *name, const char *service, enum mdns_sd_proto proto, u16_t port, u32_t dns_ttl, service_get_txt_fn_t txt_fn, void *txt_userdata);
|
||||||
|
err_t mdns_resp_del_service(struct netif *netif, s8_t slot);
|
||||||
|
err_t mdns_resp_rename_service(struct netif *netif, s8_t slot, const char *name);
|
||||||
|
|
||||||
|
err_t mdns_resp_add_service_txtitem(struct mdns_service *service, const char *txt, u8_t txt_len);
|
||||||
|
|
||||||
|
void mdns_resp_restart(struct netif *netif);
|
||||||
|
void mdns_resp_announce(struct netif *netif);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup mdns
|
||||||
|
* Announce IP settings have changed on netif.
|
||||||
|
* Call this in your callback registered by netif_set_status_callback().
|
||||||
|
* No need to call this function when LWIP_NETIF_EXT_STATUS_CALLBACK==1,
|
||||||
|
* this handled automatically for you.
|
||||||
|
* @param netif The network interface where settings have changed.
|
||||||
|
*/
|
||||||
|
#define mdns_resp_netif_settings_changed(netif) mdns_resp_announce(netif)
|
||||||
|
|
||||||
|
#endif /* LWIP_MDNS_RESPONDER */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_MDNS_H */
|
||||||
+80
@@ -0,0 +1,80 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* MDNS responder
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 Verisure Innovation AB
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Erik Ekman <erik@kryo.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_APPS_MDNS_OPTS_H
|
||||||
|
#define LWIP_HDR_APPS_MDNS_OPTS_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup mdns_opts Options
|
||||||
|
* @ingroup mdns
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LWIP_MDNS_RESPONDER==1: Turn on multicast DNS module. UDP must be available for MDNS
|
||||||
|
* transport. IGMP is needed for IPv4 multicast.
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_MDNS_RESPONDER
|
||||||
|
#define LWIP_MDNS_RESPONDER 0
|
||||||
|
#endif /* LWIP_MDNS_RESPONDER */
|
||||||
|
|
||||||
|
/** The maximum number of services per netif */
|
||||||
|
#ifndef MDNS_MAX_SERVICES
|
||||||
|
#define MDNS_MAX_SERVICES 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** MDNS_RESP_USENETIF_EXTCALLBACK==1: register an ext_callback on the netif
|
||||||
|
* to automatically restart probing/announcing on status or address change.
|
||||||
|
*/
|
||||||
|
#ifndef MDNS_RESP_USENETIF_EXTCALLBACK
|
||||||
|
#define MDNS_RESP_USENETIF_EXTCALLBACK LWIP_NETIF_EXT_STATUS_CALLBACK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MDNS_DEBUG: Enable debugging for multicast DNS.
|
||||||
|
*/
|
||||||
|
#ifndef MDNS_DEBUG
|
||||||
|
#define MDNS_DEBUG LWIP_DBG_OFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_MDNS_OPTS_H */
|
||||||
+74
@@ -0,0 +1,74 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* MDNS responder private definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 Verisure Innovation AB
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Erik Ekman <erik@kryo.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_MDNS_PRIV_H
|
||||||
|
#define LWIP_HDR_MDNS_PRIV_H
|
||||||
|
|
||||||
|
#include "lwip/apps/mdns_opts.h"
|
||||||
|
#include "lwip/pbuf.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LWIP_MDNS_RESPONDER
|
||||||
|
|
||||||
|
/* Domain struct and methods - visible for unit tests */
|
||||||
|
|
||||||
|
#define MDNS_DOMAIN_MAXLEN 256
|
||||||
|
#define MDNS_READNAME_ERROR 0xFFFF
|
||||||
|
|
||||||
|
struct mdns_domain {
|
||||||
|
/* Encoded domain name */
|
||||||
|
u8_t name[MDNS_DOMAIN_MAXLEN];
|
||||||
|
/* Total length of domain name, including zero */
|
||||||
|
u16_t length;
|
||||||
|
/* Set if compression of this domain is not allowed */
|
||||||
|
u8_t skip_compression;
|
||||||
|
};
|
||||||
|
|
||||||
|
err_t mdns_domain_add_label(struct mdns_domain *domain, const char *label, u8_t len);
|
||||||
|
u16_t mdns_readname(struct pbuf *p, u16_t offset, struct mdns_domain *domain);
|
||||||
|
int mdns_domain_eq(struct mdns_domain *a, struct mdns_domain *b);
|
||||||
|
u16_t mdns_compress_domain(struct pbuf *pbuf, u16_t *offset, struct mdns_domain *domain);
|
||||||
|
|
||||||
|
#endif /* LWIP_MDNS_RESPONDER */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_MDNS_PRIV_H */
|
||||||
+205
@@ -0,0 +1,205 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* MQTT client
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Erik Andersson
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Erik Andersson
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_APPS_MQTT_CLIENT_H
|
||||||
|
#define LWIP_HDR_APPS_MQTT_CLIENT_H
|
||||||
|
|
||||||
|
#include "lwip/apps/mqtt_opts.h"
|
||||||
|
#include "lwip/err.h"
|
||||||
|
#include "lwip/ip_addr.h"
|
||||||
|
#include "lwip/prot/iana.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct mqtt_client_s mqtt_client_t;
|
||||||
|
|
||||||
|
#if LWIP_ALTCP && LWIP_ALTCP_TLS
|
||||||
|
struct altcp_tls_config;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** @ingroup mqtt
|
||||||
|
* Default MQTT port (non-TLS) */
|
||||||
|
#define MQTT_PORT LWIP_IANA_PORT_MQTT
|
||||||
|
/** @ingroup mqtt
|
||||||
|
* Default MQTT TLS port */
|
||||||
|
#define MQTT_TLS_PORT LWIP_IANA_PORT_SECURE_MQTT
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------------------- */
|
||||||
|
/* Connection with server */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup mqtt
|
||||||
|
* Client information and connection parameters */
|
||||||
|
struct mqtt_connect_client_info_t {
|
||||||
|
/** Client identifier, must be set by caller */
|
||||||
|
const char *client_id;
|
||||||
|
/** User name, set to NULL if not used */
|
||||||
|
const char* client_user;
|
||||||
|
/** Password, set to NULL if not used */
|
||||||
|
const char* client_pass;
|
||||||
|
/** keep alive time in seconds, 0 to disable keep alive functionality*/
|
||||||
|
u16_t keep_alive;
|
||||||
|
/** will topic, set to NULL if will is not to be used,
|
||||||
|
will_msg, will_qos and will retain are then ignored */
|
||||||
|
const char* will_topic;
|
||||||
|
/** will_msg, see will_topic */
|
||||||
|
const char* will_msg;
|
||||||
|
/** will_qos, see will_topic */
|
||||||
|
u8_t will_qos;
|
||||||
|
/** will_retain, see will_topic */
|
||||||
|
u8_t will_retain;
|
||||||
|
#if LWIP_ALTCP && LWIP_ALTCP_TLS
|
||||||
|
/** TLS configuration for secure connections */
|
||||||
|
struct altcp_tls_config *tls_config;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup mqtt
|
||||||
|
* Connection status codes */
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
/** Accepted */
|
||||||
|
MQTT_CONNECT_ACCEPTED = 0,
|
||||||
|
/** Refused protocol version */
|
||||||
|
MQTT_CONNECT_REFUSED_PROTOCOL_VERSION = 1,
|
||||||
|
/** Refused identifier */
|
||||||
|
MQTT_CONNECT_REFUSED_IDENTIFIER = 2,
|
||||||
|
/** Refused server */
|
||||||
|
MQTT_CONNECT_REFUSED_SERVER = 3,
|
||||||
|
/** Refused user credentials */
|
||||||
|
MQTT_CONNECT_REFUSED_USERNAME_PASS = 4,
|
||||||
|
/** Refused not authorized */
|
||||||
|
MQTT_CONNECT_REFUSED_NOT_AUTHORIZED_ = 5,
|
||||||
|
/** Disconnected */
|
||||||
|
MQTT_CONNECT_DISCONNECTED = 256,
|
||||||
|
/** Timeout */
|
||||||
|
MQTT_CONNECT_TIMEOUT = 257
|
||||||
|
} mqtt_connection_status_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup mqtt
|
||||||
|
* Function prototype for mqtt connection status callback. Called when
|
||||||
|
* client has connected to the server after initiating a mqtt connection attempt by
|
||||||
|
* calling mqtt_client_connect() or when connection is closed by server or an error
|
||||||
|
*
|
||||||
|
* @param client MQTT client itself
|
||||||
|
* @param arg Additional argument to pass to the callback function
|
||||||
|
* @param status Connect result code or disconnection notification @see mqtt_connection_status_t
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef void (*mqtt_connection_cb_t)(mqtt_client_t *client, void *arg, mqtt_connection_status_t status);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup mqtt
|
||||||
|
* Data callback flags */
|
||||||
|
enum {
|
||||||
|
/** Flag set when last fragment of data arrives in data callback */
|
||||||
|
MQTT_DATA_FLAG_LAST = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup mqtt
|
||||||
|
* Function prototype for MQTT incoming publish data callback function. Called when data
|
||||||
|
* arrives to a subscribed topic @see mqtt_subscribe
|
||||||
|
*
|
||||||
|
* @param arg Additional argument to pass to the callback function
|
||||||
|
* @param data User data, pointed object, data may not be referenced after callback return,
|
||||||
|
NULL is passed when all publish data are delivered
|
||||||
|
* @param len Length of publish data fragment
|
||||||
|
* @param flags MQTT_DATA_FLAG_LAST set when this call contains the last part of data from publish message
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef void (*mqtt_incoming_data_cb_t)(void *arg, const u8_t *data, u16_t len, u8_t flags);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup mqtt
|
||||||
|
* Function prototype for MQTT incoming publish function. Called when an incoming publish
|
||||||
|
* arrives to a subscribed topic @see mqtt_subscribe
|
||||||
|
*
|
||||||
|
* @param arg Additional argument to pass to the callback function
|
||||||
|
* @param topic Zero terminated Topic text string, topic may not be referenced after callback return
|
||||||
|
* @param tot_len Total length of publish data, if set to 0 (no publish payload) data callback will not be invoked
|
||||||
|
*/
|
||||||
|
typedef void (*mqtt_incoming_publish_cb_t)(void *arg, const char *topic, u32_t tot_len);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup mqtt
|
||||||
|
* Function prototype for mqtt request callback. Called when a subscribe, unsubscribe
|
||||||
|
* or publish request has completed
|
||||||
|
* @param arg Pointer to user data supplied when invoking request
|
||||||
|
* @param err ERR_OK on success
|
||||||
|
* ERR_TIMEOUT if no response was received within timeout,
|
||||||
|
* ERR_ABRT if (un)subscribe was denied
|
||||||
|
*/
|
||||||
|
typedef void (*mqtt_request_cb_t)(void *arg, err_t err);
|
||||||
|
|
||||||
|
|
||||||
|
err_t mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ipaddr, u16_t port, mqtt_connection_cb_t cb, void *arg,
|
||||||
|
const struct mqtt_connect_client_info_t *client_info);
|
||||||
|
|
||||||
|
void mqtt_disconnect(mqtt_client_t *client);
|
||||||
|
|
||||||
|
mqtt_client_t *mqtt_client_new(void);
|
||||||
|
void mqtt_client_free(mqtt_client_t* client);
|
||||||
|
|
||||||
|
u8_t mqtt_client_is_connected(mqtt_client_t *client);
|
||||||
|
|
||||||
|
void mqtt_set_inpub_callback(mqtt_client_t *client, mqtt_incoming_publish_cb_t,
|
||||||
|
mqtt_incoming_data_cb_t data_cb, void *arg);
|
||||||
|
|
||||||
|
err_t mqtt_sub_unsub(mqtt_client_t *client, const char *topic, u8_t qos, mqtt_request_cb_t cb, void *arg, u8_t sub);
|
||||||
|
|
||||||
|
/** @ingroup mqtt
|
||||||
|
*Subscribe to topic */
|
||||||
|
#define mqtt_subscribe(client, topic, qos, cb, arg) mqtt_sub_unsub(client, topic, qos, cb, arg, 1)
|
||||||
|
/** @ingroup mqtt
|
||||||
|
* Unsubscribe to topic */
|
||||||
|
#define mqtt_unsubscribe(client, topic, cb, arg) mqtt_sub_unsub(client, topic, 0, cb, arg, 0)
|
||||||
|
|
||||||
|
err_t mqtt_publish(mqtt_client_t *client, const char *topic, const void *payload, u16_t payload_length, u8_t qos, u8_t retain,
|
||||||
|
mqtt_request_cb_t cb, void *arg);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_MQTT_CLIENT_H */
|
||||||
+103
@@ -0,0 +1,103 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* MQTT client options
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Erik Andersson
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Erik Andersson
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_APPS_MQTT_OPTS_H
|
||||||
|
#define LWIP_HDR_APPS_MQTT_OPTS_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup mqtt_opts Options
|
||||||
|
* @ingroup mqtt
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output ring-buffer size, must be able to fit largest outgoing publish message topic+payloads
|
||||||
|
*/
|
||||||
|
#ifndef MQTT_OUTPUT_RINGBUF_SIZE
|
||||||
|
#define MQTT_OUTPUT_RINGBUF_SIZE 256
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of bytes in receive buffer, must be at least the size of the longest incoming topic + 8
|
||||||
|
* If one wants to avoid fragmented incoming publish, set length to max incoming topic length + max payload length + 8
|
||||||
|
*/
|
||||||
|
#ifndef MQTT_VAR_HEADER_BUFFER_LEN
|
||||||
|
#define MQTT_VAR_HEADER_BUFFER_LEN 128
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum number of pending subscribe, unsubscribe and publish requests to server .
|
||||||
|
*/
|
||||||
|
#ifndef MQTT_REQ_MAX_IN_FLIGHT
|
||||||
|
#define MQTT_REQ_MAX_IN_FLIGHT 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Seconds between each cyclic timer call.
|
||||||
|
*/
|
||||||
|
#ifndef MQTT_CYCLIC_TIMER_INTERVAL
|
||||||
|
#define MQTT_CYCLIC_TIMER_INTERVAL 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Publish, subscribe and unsubscribe request timeout in seconds.
|
||||||
|
*/
|
||||||
|
#ifndef MQTT_REQ_TIMEOUT
|
||||||
|
#define MQTT_REQ_TIMEOUT 30
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Seconds for MQTT connect response timeout after sending connect request
|
||||||
|
*/
|
||||||
|
#ifndef MQTT_CONNECT_TIMOUT
|
||||||
|
#define MQTT_CONNECT_TIMOUT 100
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_MQTT_OPTS_H */
|
||||||
+104
@@ -0,0 +1,104 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* MQTT client (private interface)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Erik Andersson
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Erik Andersson
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_APPS_MQTT_PRIV_H
|
||||||
|
#define LWIP_HDR_APPS_MQTT_PRIV_H
|
||||||
|
|
||||||
|
#include "lwip/apps/mqtt.h"
|
||||||
|
#include "lwip/altcp.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Pending request item, binds application callback to pending server requests */
|
||||||
|
struct mqtt_request_t
|
||||||
|
{
|
||||||
|
/** Next item in list, NULL means this is the last in chain,
|
||||||
|
next pointing at itself means request is unallocated */
|
||||||
|
struct mqtt_request_t *next;
|
||||||
|
/** Callback to upper layer */
|
||||||
|
mqtt_request_cb_t cb;
|
||||||
|
void *arg;
|
||||||
|
/** MQTT packet identifier */
|
||||||
|
u16_t pkt_id;
|
||||||
|
/** Expire time relative to element before this */
|
||||||
|
u16_t timeout_diff;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Ring buffer */
|
||||||
|
struct mqtt_ringbuf_t {
|
||||||
|
u16_t put;
|
||||||
|
u16_t get;
|
||||||
|
u8_t buf[MQTT_OUTPUT_RINGBUF_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
/** MQTT client */
|
||||||
|
struct mqtt_client_s
|
||||||
|
{
|
||||||
|
/** Timers and timeouts */
|
||||||
|
u16_t cyclic_tick;
|
||||||
|
u16_t keep_alive;
|
||||||
|
u16_t server_watchdog;
|
||||||
|
/** Packet identifier generator*/
|
||||||
|
u16_t pkt_id_seq;
|
||||||
|
/** Packet identifier of pending incoming publish */
|
||||||
|
u16_t inpub_pkt_id;
|
||||||
|
/** Connection state */
|
||||||
|
u8_t conn_state;
|
||||||
|
struct altcp_pcb *conn;
|
||||||
|
/** Connection callback */
|
||||||
|
void *connect_arg;
|
||||||
|
mqtt_connection_cb_t connect_cb;
|
||||||
|
/** Pending requests to server */
|
||||||
|
struct mqtt_request_t *pend_req_queue;
|
||||||
|
struct mqtt_request_t req_list[MQTT_REQ_MAX_IN_FLIGHT];
|
||||||
|
void *inpub_arg;
|
||||||
|
/** Incoming data callback */
|
||||||
|
mqtt_incoming_data_cb_t data_cb;
|
||||||
|
mqtt_incoming_publish_cb_t pub_cb;
|
||||||
|
/** Input */
|
||||||
|
u32_t msg_idx;
|
||||||
|
u8_t rx_buffer[MQTT_VAR_HEADER_BUFFER_LEN];
|
||||||
|
/** Output ring-buffer */
|
||||||
|
struct mqtt_ringbuf_t output;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_MQTT_PRIV_H */
|
||||||
+51
@@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* NETBIOS name service responder
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_APPS_NETBIOS_H
|
||||||
|
#define LWIP_HDR_APPS_NETBIOS_H
|
||||||
|
|
||||||
|
#include "lwip/apps/netbiosns_opts.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void netbiosns_init(void);
|
||||||
|
#ifndef NETBIOS_LWIP_NAME
|
||||||
|
void netbiosns_set_name(const char* hostname);
|
||||||
|
#endif
|
||||||
|
void netbiosns_stop(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_NETBIOS_H */
|
||||||
+66
@@ -0,0 +1,66 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* NETBIOS name service responder options
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_APPS_NETBIOS_OPTS_H
|
||||||
|
#define LWIP_HDR_APPS_NETBIOS_OPTS_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup netbiosns_opts Options
|
||||||
|
* @ingroup netbiosns
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** NetBIOS name of lwip device
|
||||||
|
* This must be uppercase until NETBIOS_STRCMP() is defined to a string
|
||||||
|
* comparison function that is case insensitive.
|
||||||
|
* If you want to use the netif's hostname, use this (with LWIP_NETIF_HOSTNAME):
|
||||||
|
* (ip_current_netif() != NULL ? ip_current_netif()->hostname != NULL ? ip_current_netif()->hostname : "" : "")
|
||||||
|
*
|
||||||
|
* If this is not defined, netbiosns_set_name() can be called at runtime to change the name.
|
||||||
|
*/
|
||||||
|
#ifdef __DOXYGEN__
|
||||||
|
#define NETBIOS_LWIP_NAME "NETBIOSLWIPDEV"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Respond to NetBIOS name queries
|
||||||
|
* Default is disabled
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_NETBIOS_RESPOND_NAME_QUERY || defined __DOXYGEN__
|
||||||
|
#define LWIP_NETBIOS_RESPOND_NAME_QUERY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_NETBIOS_OPTS_H */
|
||||||
+128
@@ -0,0 +1,128 @@
|
|||||||
|
#ifndef LWIP_HDR_APPS_SMTP_H
|
||||||
|
#define LWIP_HDR_APPS_SMTP_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "lwip/apps/smtp_opts.h"
|
||||||
|
#include "lwip/err.h"
|
||||||
|
#include "lwip/prot/iana.h"
|
||||||
|
|
||||||
|
/** The default TCP port used for SMTP */
|
||||||
|
#define SMTP_DEFAULT_PORT LWIP_IANA_PORT_SMTP
|
||||||
|
/** The default TCP port used for SMTPS */
|
||||||
|
#define SMTPS_DEFAULT_PORT LWIP_IANA_PORT_SMTPS
|
||||||
|
|
||||||
|
/** Email successfully sent */
|
||||||
|
#define SMTP_RESULT_OK 0
|
||||||
|
/** Unknown error */
|
||||||
|
#define SMTP_RESULT_ERR_UNKNOWN 1
|
||||||
|
/** Connection to server failed */
|
||||||
|
#define SMTP_RESULT_ERR_CONNECT 2
|
||||||
|
/** Failed to resolve server hostname */
|
||||||
|
#define SMTP_RESULT_ERR_HOSTNAME 3
|
||||||
|
/** Connection unexpectedly closed by remote server */
|
||||||
|
#define SMTP_RESULT_ERR_CLOSED 4
|
||||||
|
/** Connection timed out (server didn't respond in time) */
|
||||||
|
#define SMTP_RESULT_ERR_TIMEOUT 5
|
||||||
|
/** Server responded with an unknown response code */
|
||||||
|
#define SMTP_RESULT_ERR_SVR_RESP 6
|
||||||
|
/** Out of resources locally */
|
||||||
|
#define SMTP_RESULT_ERR_MEM 7
|
||||||
|
|
||||||
|
/** Prototype of an smtp callback function
|
||||||
|
*
|
||||||
|
* @param arg argument specified when initiating the email
|
||||||
|
* @param smtp_result result of the mail transfer (see defines SMTP_RESULT_*)
|
||||||
|
* @param srv_err if aborted by the server, this contains the error code received
|
||||||
|
* @param err an error returned by internal lwip functions, can help to specify
|
||||||
|
* the source of the error but must not necessarily be != ERR_OK
|
||||||
|
*/
|
||||||
|
typedef void (*smtp_result_fn)(void *arg, u8_t smtp_result, u16_t srv_err, err_t err);
|
||||||
|
|
||||||
|
/** This structure is used as argument for smtp_send_mail_int(),
|
||||||
|
* which in turn can be used with tcpip_callback() to send mail
|
||||||
|
* from interrupt context, e.g. like this:
|
||||||
|
* struct smtp_send_request *req; (to be filled)
|
||||||
|
* tcpip_try_callback(smtp_send_mail_int, (void*)req);
|
||||||
|
*
|
||||||
|
* For member description, see parameter description of smtp_send_mail().
|
||||||
|
* When using with tcpip_callback, this structure has to stay allocated
|
||||||
|
* (e.g. using mem_malloc/mem_free) until its 'callback_fn' is called.
|
||||||
|
*/
|
||||||
|
struct smtp_send_request {
|
||||||
|
const char *from;
|
||||||
|
const char* to;
|
||||||
|
const char* subject;
|
||||||
|
const char* body;
|
||||||
|
smtp_result_fn callback_fn;
|
||||||
|
void* callback_arg;
|
||||||
|
/** If this is != 0, data is *not* copied into an extra buffer
|
||||||
|
* but used from the pointers supplied in this struct.
|
||||||
|
* This means less memory usage, but data must stay untouched until
|
||||||
|
* the callback function is called. */
|
||||||
|
u8_t static_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#if SMTP_BODYDH
|
||||||
|
|
||||||
|
#ifndef SMTP_BODYDH_BUFFER_SIZE
|
||||||
|
#define SMTP_BODYDH_BUFFER_SIZE 256
|
||||||
|
#endif /* SMTP_BODYDH_BUFFER_SIZE */
|
||||||
|
|
||||||
|
struct smtp_bodydh {
|
||||||
|
u16_t state;
|
||||||
|
u16_t length; /* Length of content in buffer */
|
||||||
|
char buffer[SMTP_BODYDH_BUFFER_SIZE]; /* buffer for generated content */
|
||||||
|
#ifdef SMTP_BODYDH_USER_SIZE
|
||||||
|
u8_t user[SMTP_BODYDH_USER_SIZE];
|
||||||
|
#endif /* SMTP_BODYDH_USER_SIZE */
|
||||||
|
};
|
||||||
|
|
||||||
|
enum bdh_retvals_e {
|
||||||
|
BDH_DONE = 0,
|
||||||
|
BDH_WORKING
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Prototype of an smtp body callback function
|
||||||
|
* It receives a struct smtp_bodydh, and a buffer to write data,
|
||||||
|
* must return BDH_WORKING to be called again and BDH_DONE when
|
||||||
|
* it has finished processing. This one tries to fill one TCP buffer with
|
||||||
|
* data, your function will be repeatedly called until that happens; so if you
|
||||||
|
* know you'll be taking too long to serve your request, pause once in a while
|
||||||
|
* by writing length=0 to avoid hogging system resources
|
||||||
|
*
|
||||||
|
* @param arg argument specified when initiating the email
|
||||||
|
* @param smtp_bodydh state handling + buffer structure
|
||||||
|
*/
|
||||||
|
typedef int (*smtp_bodycback_fn)(void *arg, struct smtp_bodydh *bodydh);
|
||||||
|
|
||||||
|
err_t smtp_send_mail_bodycback(const char *from, const char* to, const char* subject,
|
||||||
|
smtp_bodycback_fn bodycback_fn, smtp_result_fn callback_fn, void* callback_arg);
|
||||||
|
|
||||||
|
#endif /* SMTP_BODYDH */
|
||||||
|
|
||||||
|
|
||||||
|
err_t smtp_set_server_addr(const char* server);
|
||||||
|
void smtp_set_server_port(u16_t port);
|
||||||
|
#if LWIP_ALTCP && LWIP_ALTCP_TLS
|
||||||
|
struct altcp_tls_config;
|
||||||
|
void smtp_set_tls_config(struct altcp_tls_config *tls_config);
|
||||||
|
#endif
|
||||||
|
err_t smtp_set_auth(const char* username, const char* pass);
|
||||||
|
err_t smtp_send_mail(const char *from, const char* to, const char* subject, const char* body,
|
||||||
|
smtp_result_fn callback_fn, void* callback_arg);
|
||||||
|
err_t smtp_send_mail_static(const char *from, const char* to, const char* subject, const char* body,
|
||||||
|
smtp_result_fn callback_fn, void* callback_arg);
|
||||||
|
void smtp_send_mail_int(void *arg);
|
||||||
|
#ifdef LWIP_DEBUG
|
||||||
|
const char* smtp_result_str(u8_t smtp_result);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_SMTP_H */
|
||||||
+80
@@ -0,0 +1,80 @@
|
|||||||
|
#ifndef LWIP_HDR_APPS_SMTP_OPTS_H
|
||||||
|
#define LWIP_HDR_APPS_SMTP_OPTS_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup smtp_opts Options
|
||||||
|
* @ingroup smtp
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Set this to 1 to enable data handler callback on BODY */
|
||||||
|
#ifndef SMTP_BODYDH
|
||||||
|
#define SMTP_BODYDH 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** SMTP_DEBUG: Enable debugging for SNTP. */
|
||||||
|
#ifndef SMTP_DEBUG
|
||||||
|
#define SMTP_DEBUG LWIP_DBG_OFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Maximum length reserved for server name including terminating 0 byte */
|
||||||
|
#ifndef SMTP_MAX_SERVERNAME_LEN
|
||||||
|
#define SMTP_MAX_SERVERNAME_LEN 256
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Maximum length reserved for username */
|
||||||
|
#ifndef SMTP_MAX_USERNAME_LEN
|
||||||
|
#define SMTP_MAX_USERNAME_LEN 32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Maximum length reserved for password */
|
||||||
|
#ifndef SMTP_MAX_PASS_LEN
|
||||||
|
#define SMTP_MAX_PASS_LEN 32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 0 if you know the authentication data will not change
|
||||||
|
* during the smtp session, which saves some heap space. */
|
||||||
|
#ifndef SMTP_COPY_AUTHDATA
|
||||||
|
#define SMTP_COPY_AUTHDATA 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 0 to save some code space if you know for sure that all data
|
||||||
|
* passed to this module conforms to the requirements in the SMTP RFC.
|
||||||
|
* WARNING: use this with care!
|
||||||
|
*/
|
||||||
|
#ifndef SMTP_CHECK_DATA
|
||||||
|
#define SMTP_CHECK_DATA 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to enable AUTH PLAIN support */
|
||||||
|
#ifndef SMTP_SUPPORT_AUTH_PLAIN
|
||||||
|
#define SMTP_SUPPORT_AUTH_PLAIN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to enable AUTH LOGIN support */
|
||||||
|
#ifndef SMTP_SUPPORT_AUTH_LOGIN
|
||||||
|
#define SMTP_SUPPORT_AUTH_LOGIN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Memory allocation/deallocation can be overridden... */
|
||||||
|
#ifndef SMTP_STATE_MALLOC
|
||||||
|
#define SMTP_STATE_MALLOC(size) mem_malloc(size)
|
||||||
|
#define SMTP_STATE_FREE(ptr) mem_free(ptr)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* SMTP_OPTS_H */
|
||||||
+135
@@ -0,0 +1,135 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* SNMP server main API - start and basic configuration
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001, 2002 Leon Woestenberg <leon.woestenberg@axon.tv>
|
||||||
|
* Copyright (c) 2001, 2002 Axon Digital Design B.V., The Netherlands.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Leon Woestenberg <leon.woestenberg@axon.tv>
|
||||||
|
* Martin Hentschel <info@cl-soft.de>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_APPS_SNMP_H
|
||||||
|
#define LWIP_HDR_APPS_SNMP_H
|
||||||
|
|
||||||
|
#include "lwip/apps/snmp_opts.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
#include "lwip/err.h"
|
||||||
|
#include "lwip/apps/snmp_core.h"
|
||||||
|
|
||||||
|
/** SNMP variable binding descriptor (publicly needed for traps) */
|
||||||
|
struct snmp_varbind
|
||||||
|
{
|
||||||
|
/** pointer to next varbind, NULL for last in list */
|
||||||
|
struct snmp_varbind *next;
|
||||||
|
/** pointer to previous varbind, NULL for first in list */
|
||||||
|
struct snmp_varbind *prev;
|
||||||
|
|
||||||
|
/** object identifier */
|
||||||
|
struct snmp_obj_id oid;
|
||||||
|
|
||||||
|
/** value ASN1 type */
|
||||||
|
u8_t type;
|
||||||
|
/** object value length */
|
||||||
|
u16_t value_len;
|
||||||
|
/** object value */
|
||||||
|
void *value;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup snmp_core
|
||||||
|
* Agent setup, start listening to port 161.
|
||||||
|
*/
|
||||||
|
void snmp_init(void);
|
||||||
|
void snmp_set_mibs(const struct snmp_mib **mibs, u8_t num_mibs);
|
||||||
|
|
||||||
|
void snmp_set_device_enterprise_oid(const struct snmp_obj_id* device_enterprise_oid);
|
||||||
|
const struct snmp_obj_id* snmp_get_device_enterprise_oid(void);
|
||||||
|
|
||||||
|
void snmp_trap_dst_enable(u8_t dst_idx, u8_t enable);
|
||||||
|
void snmp_trap_dst_ip_set(u8_t dst_idx, const ip_addr_t *dst);
|
||||||
|
|
||||||
|
/** Generic trap: cold start */
|
||||||
|
#define SNMP_GENTRAP_COLDSTART 0
|
||||||
|
/** Generic trap: warm start */
|
||||||
|
#define SNMP_GENTRAP_WARMSTART 1
|
||||||
|
/** Generic trap: link down */
|
||||||
|
#define SNMP_GENTRAP_LINKDOWN 2
|
||||||
|
/** Generic trap: link up */
|
||||||
|
#define SNMP_GENTRAP_LINKUP 3
|
||||||
|
/** Generic trap: authentication failure */
|
||||||
|
#define SNMP_GENTRAP_AUTH_FAILURE 4
|
||||||
|
/** Generic trap: EGP neighbor lost */
|
||||||
|
#define SNMP_GENTRAP_EGP_NEIGHBOR_LOSS 5
|
||||||
|
/** Generic trap: enterprise specific */
|
||||||
|
#define SNMP_GENTRAP_ENTERPRISE_SPECIFIC 6
|
||||||
|
|
||||||
|
err_t snmp_send_trap_generic(s32_t generic_trap);
|
||||||
|
err_t snmp_send_trap_specific(s32_t specific_trap, struct snmp_varbind *varbinds);
|
||||||
|
err_t snmp_send_trap(const struct snmp_obj_id* oid, s32_t generic_trap, s32_t specific_trap, struct snmp_varbind *varbinds);
|
||||||
|
|
||||||
|
#define SNMP_AUTH_TRAPS_DISABLED 0
|
||||||
|
#define SNMP_AUTH_TRAPS_ENABLED 1
|
||||||
|
void snmp_set_auth_traps_enabled(u8_t enable);
|
||||||
|
u8_t snmp_get_auth_traps_enabled(void);
|
||||||
|
|
||||||
|
u8_t snmp_v1_enabled(void);
|
||||||
|
u8_t snmp_v2c_enabled(void);
|
||||||
|
u8_t snmp_v3_enabled(void);
|
||||||
|
void snmp_v1_enable(u8_t enable);
|
||||||
|
void snmp_v2c_enable(u8_t enable);
|
||||||
|
void snmp_v3_enable(u8_t enable);
|
||||||
|
|
||||||
|
const char * snmp_get_community(void);
|
||||||
|
const char * snmp_get_community_write(void);
|
||||||
|
const char * snmp_get_community_trap(void);
|
||||||
|
void snmp_set_community(const char * const community);
|
||||||
|
void snmp_set_community_write(const char * const community);
|
||||||
|
void snmp_set_community_trap(const char * const community);
|
||||||
|
|
||||||
|
void snmp_coldstart_trap(void);
|
||||||
|
void snmp_authfail_trap(void);
|
||||||
|
|
||||||
|
typedef void (*snmp_write_callback_fct)(const u32_t* oid, u8_t oid_len, void* callback_arg);
|
||||||
|
void snmp_set_write_callback(snmp_write_callback_fct write_callback, void* callback_arg);
|
||||||
|
|
||||||
|
#endif /* LWIP_SNMP */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_SNMP_H */
|
||||||
+377
@@ -0,0 +1,377 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* SNMP core API for implementing MIBs
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Author: Christiaan Simons <christiaan.simons@axon.tv>
|
||||||
|
* Martin Hentschel <info@cl-soft.de>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_APPS_SNMP_CORE_H
|
||||||
|
#define LWIP_HDR_APPS_SNMP_CORE_H
|
||||||
|
|
||||||
|
#include "lwip/apps/snmp_opts.h"
|
||||||
|
|
||||||
|
#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
#include "lwip/ip_addr.h"
|
||||||
|
#include "lwip/err.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* basic ASN1 defines */
|
||||||
|
#define SNMP_ASN1_CLASS_UNIVERSAL 0x00
|
||||||
|
#define SNMP_ASN1_CLASS_APPLICATION 0x40
|
||||||
|
#define SNMP_ASN1_CLASS_CONTEXT 0x80
|
||||||
|
#define SNMP_ASN1_CLASS_PRIVATE 0xC0
|
||||||
|
|
||||||
|
#define SNMP_ASN1_CONTENTTYPE_PRIMITIVE 0x00
|
||||||
|
#define SNMP_ASN1_CONTENTTYPE_CONSTRUCTED 0x20
|
||||||
|
|
||||||
|
/* universal tags (from ASN.1 spec.) */
|
||||||
|
#define SNMP_ASN1_UNIVERSAL_END_OF_CONTENT 0
|
||||||
|
#define SNMP_ASN1_UNIVERSAL_INTEGER 2
|
||||||
|
#define SNMP_ASN1_UNIVERSAL_OCTET_STRING 4
|
||||||
|
#define SNMP_ASN1_UNIVERSAL_NULL 5
|
||||||
|
#define SNMP_ASN1_UNIVERSAL_OBJECT_ID 6
|
||||||
|
#define SNMP_ASN1_UNIVERSAL_SEQUENCE_OF 16
|
||||||
|
|
||||||
|
/* application specific (SNMP) tags (from SNMPv2-SMI) */
|
||||||
|
#define SNMP_ASN1_APPLICATION_IPADDR 0 /* [APPLICATION 0] IMPLICIT OCTET STRING (SIZE (4)) */
|
||||||
|
#define SNMP_ASN1_APPLICATION_COUNTER 1 /* [APPLICATION 1] IMPLICIT INTEGER (0..4294967295) => u32_t */
|
||||||
|
#define SNMP_ASN1_APPLICATION_GAUGE 2 /* [APPLICATION 2] IMPLICIT INTEGER (0..4294967295) => u32_t */
|
||||||
|
#define SNMP_ASN1_APPLICATION_TIMETICKS 3 /* [APPLICATION 3] IMPLICIT INTEGER (0..4294967295) => u32_t */
|
||||||
|
#define SNMP_ASN1_APPLICATION_OPAQUE 4 /* [APPLICATION 4] IMPLICIT OCTET STRING */
|
||||||
|
#define SNMP_ASN1_APPLICATION_COUNTER64 6 /* [APPLICATION 6] IMPLICIT INTEGER (0..18446744073709551615) */
|
||||||
|
|
||||||
|
/* context specific (SNMP) tags (from RFC 1905) */
|
||||||
|
#define SNMP_ASN1_CONTEXT_VARBIND_NO_SUCH_INSTANCE 1
|
||||||
|
|
||||||
|
/* full ASN1 type defines */
|
||||||
|
#define SNMP_ASN1_TYPE_END_OF_CONTENT (SNMP_ASN1_CLASS_UNIVERSAL | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_UNIVERSAL_END_OF_CONTENT)
|
||||||
|
#define SNMP_ASN1_TYPE_INTEGER (SNMP_ASN1_CLASS_UNIVERSAL | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_UNIVERSAL_INTEGER)
|
||||||
|
#define SNMP_ASN1_TYPE_OCTET_STRING (SNMP_ASN1_CLASS_UNIVERSAL | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_UNIVERSAL_OCTET_STRING)
|
||||||
|
#define SNMP_ASN1_TYPE_NULL (SNMP_ASN1_CLASS_UNIVERSAL | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_UNIVERSAL_NULL)
|
||||||
|
#define SNMP_ASN1_TYPE_OBJECT_ID (SNMP_ASN1_CLASS_UNIVERSAL | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_UNIVERSAL_OBJECT_ID)
|
||||||
|
#define SNMP_ASN1_TYPE_SEQUENCE (SNMP_ASN1_CLASS_UNIVERSAL | SNMP_ASN1_CONTENTTYPE_CONSTRUCTED | SNMP_ASN1_UNIVERSAL_SEQUENCE_OF)
|
||||||
|
#define SNMP_ASN1_TYPE_IPADDR (SNMP_ASN1_CLASS_APPLICATION | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_APPLICATION_IPADDR)
|
||||||
|
#define SNMP_ASN1_TYPE_IPADDRESS SNMP_ASN1_TYPE_IPADDR
|
||||||
|
#define SNMP_ASN1_TYPE_COUNTER (SNMP_ASN1_CLASS_APPLICATION | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_APPLICATION_COUNTER)
|
||||||
|
#define SNMP_ASN1_TYPE_COUNTER32 SNMP_ASN1_TYPE_COUNTER
|
||||||
|
#define SNMP_ASN1_TYPE_GAUGE (SNMP_ASN1_CLASS_APPLICATION | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_APPLICATION_GAUGE)
|
||||||
|
#define SNMP_ASN1_TYPE_GAUGE32 SNMP_ASN1_TYPE_GAUGE
|
||||||
|
#define SNMP_ASN1_TYPE_UNSIGNED32 SNMP_ASN1_TYPE_GAUGE
|
||||||
|
#define SNMP_ASN1_TYPE_TIMETICKS (SNMP_ASN1_CLASS_APPLICATION | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_APPLICATION_TIMETICKS)
|
||||||
|
#define SNMP_ASN1_TYPE_OPAQUE (SNMP_ASN1_CLASS_APPLICATION | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_APPLICATION_OPAQUE)
|
||||||
|
#if LWIP_HAVE_INT64
|
||||||
|
#define SNMP_ASN1_TYPE_COUNTER64 (SNMP_ASN1_CLASS_APPLICATION | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_APPLICATION_COUNTER64)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define SNMP_VARBIND_EXCEPTION_OFFSET 0xF0
|
||||||
|
#define SNMP_VARBIND_EXCEPTION_MASK 0x0F
|
||||||
|
|
||||||
|
/** error codes predefined by SNMP prot. */
|
||||||
|
typedef enum {
|
||||||
|
SNMP_ERR_NOERROR = 0,
|
||||||
|
/*
|
||||||
|
outdated v1 error codes. do not use anmore!
|
||||||
|
#define SNMP_ERR_NOSUCHNAME 2 use SNMP_ERR_NOSUCHINSTANCE instead
|
||||||
|
#define SNMP_ERR_BADVALUE 3 use SNMP_ERR_WRONGTYPE,SNMP_ERR_WRONGLENGTH,SNMP_ERR_WRONGENCODING or SNMP_ERR_WRONGVALUE instead
|
||||||
|
#define SNMP_ERR_READONLY 4 use SNMP_ERR_NOTWRITABLE instead
|
||||||
|
*/
|
||||||
|
SNMP_ERR_GENERROR = 5,
|
||||||
|
SNMP_ERR_NOACCESS = 6,
|
||||||
|
SNMP_ERR_WRONGTYPE = 7,
|
||||||
|
SNMP_ERR_WRONGLENGTH = 8,
|
||||||
|
SNMP_ERR_WRONGENCODING = 9,
|
||||||
|
SNMP_ERR_WRONGVALUE = 10,
|
||||||
|
SNMP_ERR_NOCREATION = 11,
|
||||||
|
SNMP_ERR_INCONSISTENTVALUE = 12,
|
||||||
|
SNMP_ERR_RESOURCEUNAVAILABLE = 13,
|
||||||
|
SNMP_ERR_COMMITFAILED = 14,
|
||||||
|
SNMP_ERR_UNDOFAILED = 15,
|
||||||
|
SNMP_ERR_NOTWRITABLE = 17,
|
||||||
|
SNMP_ERR_INCONSISTENTNAME = 18,
|
||||||
|
|
||||||
|
SNMP_ERR_NOSUCHINSTANCE = SNMP_VARBIND_EXCEPTION_OFFSET + SNMP_ASN1_CONTEXT_VARBIND_NO_SUCH_INSTANCE
|
||||||
|
} snmp_err_t;
|
||||||
|
|
||||||
|
/** internal object identifier representation */
|
||||||
|
struct snmp_obj_id
|
||||||
|
{
|
||||||
|
u8_t len;
|
||||||
|
u32_t id[SNMP_MAX_OBJ_ID_LEN];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct snmp_obj_id_const_ref
|
||||||
|
{
|
||||||
|
u8_t len;
|
||||||
|
const u32_t* id;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const struct snmp_obj_id_const_ref snmp_zero_dot_zero; /* administrative identifier from SNMPv2-SMI */
|
||||||
|
|
||||||
|
/** SNMP variant value, used as reference in struct snmp_node_instance and table implementation */
|
||||||
|
union snmp_variant_value
|
||||||
|
{
|
||||||
|
void* ptr;
|
||||||
|
const void* const_ptr;
|
||||||
|
u32_t u32;
|
||||||
|
s32_t s32;
|
||||||
|
#if LWIP_HAVE_INT64
|
||||||
|
u64_t u64;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
SNMP MIB node types
|
||||||
|
tree node is the only node the stack can process in order to walk the tree,
|
||||||
|
all other nodes are assumed to be leaf nodes.
|
||||||
|
This cannot be an enum because users may want to define their own node types.
|
||||||
|
*/
|
||||||
|
#define SNMP_NODE_TREE 0x00
|
||||||
|
/* predefined leaf node types */
|
||||||
|
#define SNMP_NODE_SCALAR 0x01
|
||||||
|
#define SNMP_NODE_SCALAR_ARRAY 0x02
|
||||||
|
#define SNMP_NODE_TABLE 0x03
|
||||||
|
#define SNMP_NODE_THREADSYNC 0x04
|
||||||
|
|
||||||
|
/** node "base class" layout, the mandatory fields for a node */
|
||||||
|
struct snmp_node
|
||||||
|
{
|
||||||
|
/** one out of SNMP_NODE_TREE or any leaf node type (like SNMP_NODE_SCALAR) */
|
||||||
|
u8_t node_type;
|
||||||
|
/** the number assigned to this node which used as part of the full OID */
|
||||||
|
u32_t oid;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** SNMP node instance access types */
|
||||||
|
typedef enum {
|
||||||
|
SNMP_NODE_INSTANCE_ACCESS_READ = 1,
|
||||||
|
SNMP_NODE_INSTANCE_ACCESS_WRITE = 2,
|
||||||
|
SNMP_NODE_INSTANCE_READ_ONLY = SNMP_NODE_INSTANCE_ACCESS_READ,
|
||||||
|
SNMP_NODE_INSTANCE_READ_WRITE = (SNMP_NODE_INSTANCE_ACCESS_READ | SNMP_NODE_INSTANCE_ACCESS_WRITE),
|
||||||
|
SNMP_NODE_INSTANCE_WRITE_ONLY = SNMP_NODE_INSTANCE_ACCESS_WRITE,
|
||||||
|
SNMP_NODE_INSTANCE_NOT_ACCESSIBLE = 0
|
||||||
|
} snmp_access_t;
|
||||||
|
|
||||||
|
struct snmp_node_instance;
|
||||||
|
|
||||||
|
typedef s16_t (*node_instance_get_value_method)(struct snmp_node_instance*, void*);
|
||||||
|
typedef snmp_err_t (*node_instance_set_test_method)(struct snmp_node_instance*, u16_t, void*);
|
||||||
|
typedef snmp_err_t (*node_instance_set_value_method)(struct snmp_node_instance*, u16_t, void*);
|
||||||
|
typedef void (*node_instance_release_method)(struct snmp_node_instance*);
|
||||||
|
|
||||||
|
#define SNMP_GET_VALUE_RAW_DATA 0x4000 /* do not use 0x8000 because return value of node_instance_get_value_method is signed16 and 0x8000 would be the signed bit */
|
||||||
|
|
||||||
|
/** SNMP node instance */
|
||||||
|
struct snmp_node_instance
|
||||||
|
{
|
||||||
|
/** prefilled with the node, get_instance() is called on; may be changed by user to any value to pass an arbitrary node between calls to get_instance() and get_value/test_value/set_value */
|
||||||
|
const struct snmp_node* node;
|
||||||
|
/** prefilled with the instance id requested; for get_instance() this is the exact oid requested; for get_next_instance() this is the relative starting point, stack expects relative oid of next node here */
|
||||||
|
struct snmp_obj_id instance_oid;
|
||||||
|
|
||||||
|
/** ASN type for this object (see snmp_asn1.h for definitions) */
|
||||||
|
u8_t asn1_type;
|
||||||
|
/** one out of instance access types defined above (SNMP_NODE_INSTANCE_READ_ONLY,...) */
|
||||||
|
snmp_access_t access;
|
||||||
|
|
||||||
|
/** returns object value for the given object identifier. Return values <0 to indicate an error */
|
||||||
|
node_instance_get_value_method get_value;
|
||||||
|
/** tests length and/or range BEFORE setting */
|
||||||
|
node_instance_set_test_method set_test;
|
||||||
|
/** sets object value, only called when set_test() was successful */
|
||||||
|
node_instance_set_value_method set_value;
|
||||||
|
/** called in any case when the instance is not required anymore by stack (useful for freeing memory allocated in get_instance/get_next_instance methods) */
|
||||||
|
node_instance_release_method release_instance;
|
||||||
|
|
||||||
|
/** reference to pass arbitrary value between calls to get_instance() and get_value/test_value/set_value */
|
||||||
|
union snmp_variant_value reference;
|
||||||
|
/** see reference (if reference is a pointer, the length of underlying data may be stored here or anything else) */
|
||||||
|
u32_t reference_len;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/** SNMP tree node */
|
||||||
|
struct snmp_tree_node
|
||||||
|
{
|
||||||
|
/** inherited "base class" members */
|
||||||
|
struct snmp_node node;
|
||||||
|
u16_t subnode_count;
|
||||||
|
const struct snmp_node* const *subnodes;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SNMP_CREATE_TREE_NODE(oid, subnodes) \
|
||||||
|
{{ SNMP_NODE_TREE, (oid) }, \
|
||||||
|
(u16_t)LWIP_ARRAYSIZE(subnodes), (subnodes) }
|
||||||
|
|
||||||
|
#define SNMP_CREATE_EMPTY_TREE_NODE(oid) \
|
||||||
|
{{ SNMP_NODE_TREE, (oid) }, \
|
||||||
|
0, NULL }
|
||||||
|
|
||||||
|
/** SNMP leaf node */
|
||||||
|
struct snmp_leaf_node
|
||||||
|
{
|
||||||
|
/** inherited "base class" members */
|
||||||
|
struct snmp_node node;
|
||||||
|
snmp_err_t (*get_instance)(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
|
||||||
|
snmp_err_t (*get_next_instance)(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** represents a single mib with its base oid and root node */
|
||||||
|
struct snmp_mib
|
||||||
|
{
|
||||||
|
const u32_t *base_oid;
|
||||||
|
u8_t base_oid_len;
|
||||||
|
const struct snmp_node *root_node;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SNMP_MIB_CREATE(oid_list, root_node) { (oid_list), (u8_t)LWIP_ARRAYSIZE(oid_list), root_node }
|
||||||
|
|
||||||
|
/** OID range structure */
|
||||||
|
struct snmp_oid_range
|
||||||
|
{
|
||||||
|
u32_t min;
|
||||||
|
u32_t max;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** checks if incoming OID length and values are in allowed ranges */
|
||||||
|
u8_t snmp_oid_in_range(const u32_t *oid_in, u8_t oid_len, const struct snmp_oid_range *oid_ranges, u8_t oid_ranges_len);
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SNMP_NEXT_OID_STATUS_SUCCESS,
|
||||||
|
SNMP_NEXT_OID_STATUS_NO_MATCH,
|
||||||
|
SNMP_NEXT_OID_STATUS_BUF_TO_SMALL
|
||||||
|
} snmp_next_oid_status_t;
|
||||||
|
|
||||||
|
/** state for next_oid_init / next_oid_check functions */
|
||||||
|
struct snmp_next_oid_state
|
||||||
|
{
|
||||||
|
const u32_t* start_oid;
|
||||||
|
u8_t start_oid_len;
|
||||||
|
|
||||||
|
u32_t* next_oid;
|
||||||
|
u8_t next_oid_len;
|
||||||
|
u8_t next_oid_max_len;
|
||||||
|
|
||||||
|
snmp_next_oid_status_t status;
|
||||||
|
void* reference;
|
||||||
|
};
|
||||||
|
|
||||||
|
void snmp_next_oid_init(struct snmp_next_oid_state *state,
|
||||||
|
const u32_t *start_oid, u8_t start_oid_len,
|
||||||
|
u32_t *next_oid_buf, u8_t next_oid_max_len);
|
||||||
|
u8_t snmp_next_oid_precheck(struct snmp_next_oid_state *state, const u32_t *oid, u8_t oid_len);
|
||||||
|
u8_t snmp_next_oid_check(struct snmp_next_oid_state *state, const u32_t *oid, u8_t oid_len, void* reference);
|
||||||
|
|
||||||
|
void snmp_oid_assign(struct snmp_obj_id* target, const u32_t *oid, u8_t oid_len);
|
||||||
|
void snmp_oid_combine(struct snmp_obj_id* target, const u32_t *oid1, u8_t oid1_len, const u32_t *oid2, u8_t oid2_len);
|
||||||
|
void snmp_oid_prefix(struct snmp_obj_id* target, const u32_t *oid, u8_t oid_len);
|
||||||
|
void snmp_oid_append(struct snmp_obj_id* target, const u32_t *oid, u8_t oid_len);
|
||||||
|
u8_t snmp_oid_equal(const u32_t *oid1, u8_t oid1_len, const u32_t *oid2, u8_t oid2_len);
|
||||||
|
s8_t snmp_oid_compare(const u32_t *oid1, u8_t oid1_len, const u32_t *oid2, u8_t oid2_len);
|
||||||
|
|
||||||
|
#if LWIP_IPV4
|
||||||
|
u8_t snmp_oid_to_ip4(const u32_t *oid, ip4_addr_t *ip);
|
||||||
|
void snmp_ip4_to_oid(const ip4_addr_t *ip, u32_t *oid);
|
||||||
|
#endif /* LWIP_IPV4 */
|
||||||
|
#if LWIP_IPV6
|
||||||
|
u8_t snmp_oid_to_ip6(const u32_t *oid, ip6_addr_t *ip);
|
||||||
|
void snmp_ip6_to_oid(const ip6_addr_t *ip, u32_t *oid);
|
||||||
|
#endif /* LWIP_IPV6 */
|
||||||
|
#if LWIP_IPV4 || LWIP_IPV6
|
||||||
|
u8_t snmp_ip_to_oid(const ip_addr_t *ip, u32_t *oid);
|
||||||
|
u8_t snmp_ip_port_to_oid(const ip_addr_t *ip, u16_t port, u32_t *oid);
|
||||||
|
|
||||||
|
u8_t snmp_oid_to_ip(const u32_t *oid, u8_t oid_len, ip_addr_t *ip);
|
||||||
|
u8_t snmp_oid_to_ip_port(const u32_t *oid, u8_t oid_len, ip_addr_t *ip, u16_t *port);
|
||||||
|
#endif /* LWIP_IPV4 || LWIP_IPV6 */
|
||||||
|
|
||||||
|
struct netif;
|
||||||
|
u8_t netif_to_num(const struct netif *netif);
|
||||||
|
|
||||||
|
snmp_err_t snmp_set_test_ok(struct snmp_node_instance* instance, u16_t value_len, void* value); /* generic function which can be used if test is always successful */
|
||||||
|
|
||||||
|
err_t snmp_decode_bits(const u8_t *buf, u32_t buf_len, u32_t *bit_value);
|
||||||
|
err_t snmp_decode_truthvalue(const s32_t *asn1_value, u8_t *bool_value);
|
||||||
|
u8_t snmp_encode_bits(u8_t *buf, u32_t buf_len, u32_t bit_value, u8_t bit_count);
|
||||||
|
u8_t snmp_encode_truthvalue(s32_t *asn1_value, u32_t bool_value);
|
||||||
|
|
||||||
|
struct snmp_statistics
|
||||||
|
{
|
||||||
|
u32_t inpkts;
|
||||||
|
u32_t outpkts;
|
||||||
|
u32_t inbadversions;
|
||||||
|
u32_t inbadcommunitynames;
|
||||||
|
u32_t inbadcommunityuses;
|
||||||
|
u32_t inasnparseerrs;
|
||||||
|
u32_t intoobigs;
|
||||||
|
u32_t innosuchnames;
|
||||||
|
u32_t inbadvalues;
|
||||||
|
u32_t inreadonlys;
|
||||||
|
u32_t ingenerrs;
|
||||||
|
u32_t intotalreqvars;
|
||||||
|
u32_t intotalsetvars;
|
||||||
|
u32_t ingetrequests;
|
||||||
|
u32_t ingetnexts;
|
||||||
|
u32_t insetrequests;
|
||||||
|
u32_t ingetresponses;
|
||||||
|
u32_t intraps;
|
||||||
|
u32_t outtoobigs;
|
||||||
|
u32_t outnosuchnames;
|
||||||
|
u32_t outbadvalues;
|
||||||
|
u32_t outgenerrs;
|
||||||
|
u32_t outgetrequests;
|
||||||
|
u32_t outgetnexts;
|
||||||
|
u32_t outsetrequests;
|
||||||
|
u32_t outgetresponses;
|
||||||
|
u32_t outtraps;
|
||||||
|
#if LWIP_SNMP_V3
|
||||||
|
u32_t unsupportedseclevels;
|
||||||
|
u32_t notintimewindows;
|
||||||
|
u32_t unknownusernames;
|
||||||
|
u32_t unknownengineids;
|
||||||
|
u32_t wrongdigests;
|
||||||
|
u32_t decryptionerrors;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct snmp_statistics snmp_stats;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_SNMP */
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_SNMP_CORE_H */
|
||||||
+78
@@ -0,0 +1,78 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* SNMP MIB2 API
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Dirk Ziegelmeier <dziegel@gmx.de>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_APPS_SNMP_MIB2_H
|
||||||
|
#define LWIP_HDR_APPS_SNMP_MIB2_H
|
||||||
|
|
||||||
|
#include "lwip/apps/snmp_opts.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */
|
||||||
|
#if SNMP_LWIP_MIB2
|
||||||
|
|
||||||
|
#include "lwip/apps/snmp_core.h"
|
||||||
|
|
||||||
|
extern const struct snmp_mib mib2;
|
||||||
|
|
||||||
|
#if SNMP_USE_NETCONN
|
||||||
|
#include "lwip/apps/snmp_threadsync.h"
|
||||||
|
void snmp_mib2_lwip_synchronizer(snmp_threadsync_called_fn fn, void* arg);
|
||||||
|
extern struct snmp_threadsync_instance snmp_mib2_lwip_locks;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SNMP_SYSSERVICES
|
||||||
|
#define SNMP_SYSSERVICES ((1 << 6) | (1 << 3) | ((IP_FORWARD) << 2))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void snmp_mib2_set_sysdescr(const u8_t* str, const u16_t* len); /* read-only be definition */
|
||||||
|
void snmp_mib2_set_syscontact(u8_t *ocstr, u16_t *ocstrlen, u16_t bufsize);
|
||||||
|
void snmp_mib2_set_syscontact_readonly(const u8_t *ocstr, const u16_t *ocstrlen);
|
||||||
|
void snmp_mib2_set_sysname(u8_t *ocstr, u16_t *ocstrlen, u16_t bufsize);
|
||||||
|
void snmp_mib2_set_sysname_readonly(const u8_t *ocstr, const u16_t *ocstrlen);
|
||||||
|
void snmp_mib2_set_syslocation(u8_t *ocstr, u16_t *ocstrlen, u16_t bufsize);
|
||||||
|
void snmp_mib2_set_syslocation_readonly(const u8_t *ocstr, const u16_t *ocstrlen);
|
||||||
|
|
||||||
|
#endif /* SNMP_LWIP_MIB2 */
|
||||||
|
#endif /* LWIP_SNMP */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_SNMP_MIB2_H */
|
||||||
+297
@@ -0,0 +1,297 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* SNMP server options list
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 Dirk Ziegelmeier
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Dirk Ziegelmeier
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_SNMP_OPTS_H
|
||||||
|
#define LWIP_HDR_SNMP_OPTS_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup snmp_opts Options
|
||||||
|
* @ingroup snmp
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LWIP_SNMP==1: This enables the lwIP SNMP agent. UDP must be available
|
||||||
|
* for SNMP transport.
|
||||||
|
* If you want to use your own SNMP agent, leave this disabled.
|
||||||
|
* To integrate MIB2 of an external agent, you need to enable
|
||||||
|
* LWIP_MIB2_CALLBACKS and MIB2_STATS. This will give you the callbacks
|
||||||
|
* and statistics counters you need to get MIB2 working.
|
||||||
|
*/
|
||||||
|
#if !defined LWIP_SNMP || defined __DOXYGEN__
|
||||||
|
#define LWIP_SNMP 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SNMP_USE_NETCONN: Use netconn API instead of raw API.
|
||||||
|
* Makes SNMP agent run in a worker thread, so blocking operations
|
||||||
|
* can be done in MIB calls.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_USE_NETCONN || defined __DOXYGEN__
|
||||||
|
#define SNMP_USE_NETCONN 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SNMP_USE_RAW: Use raw API.
|
||||||
|
* SNMP agent does not run in a worker thread, so blocking operations
|
||||||
|
* should not be done in MIB calls.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_USE_RAW || defined __DOXYGEN__
|
||||||
|
#define SNMP_USE_RAW 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if SNMP_USE_NETCONN && SNMP_USE_RAW
|
||||||
|
#error SNMP stack can use only one of the APIs {raw, netconn}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LWIP_SNMP && !SNMP_USE_NETCONN && !SNMP_USE_RAW
|
||||||
|
#error SNMP stack needs a receive API and UDP {raw, netconn}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if SNMP_USE_NETCONN
|
||||||
|
/**
|
||||||
|
* SNMP_STACK_SIZE: Stack size of SNMP netconn worker thread
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_STACK_SIZE || defined __DOXYGEN__
|
||||||
|
#define SNMP_STACK_SIZE DEFAULT_THREAD_STACKSIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SNMP_THREAD_PRIO: SNMP netconn worker thread priority
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_THREAD_PRIO || defined __DOXYGEN__
|
||||||
|
#define SNMP_THREAD_PRIO DEFAULT_THREAD_PRIO
|
||||||
|
#endif
|
||||||
|
#endif /* SNMP_USE_NETCONN */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SNMP_TRAP_DESTINATIONS: Number of trap destinations. At least one trap
|
||||||
|
* destination is required
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_TRAP_DESTINATIONS || defined __DOXYGEN__
|
||||||
|
#define SNMP_TRAP_DESTINATIONS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only allow SNMP write actions that are 'safe' (e.g. disabling netifs is not
|
||||||
|
* a safe action and disabled when SNMP_SAFE_REQUESTS = 1).
|
||||||
|
* Unsafe requests are disabled by default!
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_SAFE_REQUESTS || defined __DOXYGEN__
|
||||||
|
#define SNMP_SAFE_REQUESTS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum length of strings used.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_MAX_OCTET_STRING_LEN || defined __DOXYGEN__
|
||||||
|
#define SNMP_MAX_OCTET_STRING_LEN 127
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum number of Sub ID's inside an object identifier.
|
||||||
|
* Indirectly this also limits the maximum depth of SNMP tree.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_MAX_OBJ_ID_LEN || defined __DOXYGEN__
|
||||||
|
#define SNMP_MAX_OBJ_ID_LEN 50
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined SNMP_MAX_VALUE_SIZE || defined __DOXYGEN__
|
||||||
|
/**
|
||||||
|
* The minimum size of a value.
|
||||||
|
*/
|
||||||
|
#define SNMP_MIN_VALUE_SIZE (2 * sizeof(u32_t*)) /* size required to store the basic types (8 bytes for counter64) */
|
||||||
|
/**
|
||||||
|
* The maximum size of a value.
|
||||||
|
*/
|
||||||
|
#define SNMP_MAX_VALUE_SIZE LWIP_MAX(LWIP_MAX((SNMP_MAX_OCTET_STRING_LEN), sizeof(u32_t)*(SNMP_MAX_OBJ_ID_LEN)), SNMP_MIN_VALUE_SIZE)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The snmp read-access community. Used for write-access and traps, too
|
||||||
|
* unless SNMP_COMMUNITY_WRITE or SNMP_COMMUNITY_TRAP are enabled, respectively.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_COMMUNITY || defined __DOXYGEN__
|
||||||
|
#define SNMP_COMMUNITY "public"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The snmp write-access community.
|
||||||
|
* Set this community to "" in order to disallow any write access.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_COMMUNITY_WRITE || defined __DOXYGEN__
|
||||||
|
#define SNMP_COMMUNITY_WRITE "private"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The snmp community used for sending traps.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_COMMUNITY_TRAP || defined __DOXYGEN__
|
||||||
|
#define SNMP_COMMUNITY_TRAP "public"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum length of community string.
|
||||||
|
* If community names shall be adjusted at runtime via snmp_set_community() calls,
|
||||||
|
* enter here the possible maximum length (+1 for terminating null character).
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_MAX_COMMUNITY_STR_LEN || defined __DOXYGEN__
|
||||||
|
#define SNMP_MAX_COMMUNITY_STR_LEN LWIP_MAX(LWIP_MAX(sizeof(SNMP_COMMUNITY), sizeof(SNMP_COMMUNITY_WRITE)), sizeof(SNMP_COMMUNITY_TRAP))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The OID identifiying the device. This may be the enterprise OID itself or any OID located below it in tree.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_DEVICE_ENTERPRISE_OID || defined __DOXYGEN__
|
||||||
|
#define SNMP_LWIP_ENTERPRISE_OID 26381
|
||||||
|
/**
|
||||||
|
* IANA assigned enterprise ID for lwIP is 26381
|
||||||
|
* @see http://www.iana.org/assignments/enterprise-numbers
|
||||||
|
*
|
||||||
|
* @note this enterprise ID is assigned to the lwIP project,
|
||||||
|
* all object identifiers living under this ID are assigned
|
||||||
|
* by the lwIP maintainers!
|
||||||
|
* @note don't change this define, use snmp_set_device_enterprise_oid()
|
||||||
|
*
|
||||||
|
* If you need to create your own private MIB you'll need
|
||||||
|
* to apply for your own enterprise ID with IANA:
|
||||||
|
* http://www.iana.org/numbers.html
|
||||||
|
*/
|
||||||
|
#define SNMP_DEVICE_ENTERPRISE_OID {1, 3, 6, 1, 4, 1, SNMP_LWIP_ENTERPRISE_OID}
|
||||||
|
/**
|
||||||
|
* Length of SNMP_DEVICE_ENTERPRISE_OID
|
||||||
|
*/
|
||||||
|
#define SNMP_DEVICE_ENTERPRISE_OID_LEN 7
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SNMP_DEBUG: Enable debugging for SNMP messages.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_DEBUG || defined __DOXYGEN__
|
||||||
|
#define SNMP_DEBUG LWIP_DBG_OFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SNMP_MIB_DEBUG: Enable debugging for SNMP MIBs.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_MIB_DEBUG || defined __DOXYGEN__
|
||||||
|
#define SNMP_MIB_DEBUG LWIP_DBG_OFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the MIB2 implementation of LWIP SNMP stack is used.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_LWIP_MIB2 || defined __DOXYGEN__
|
||||||
|
#define SNMP_LWIP_MIB2 LWIP_SNMP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value return for sysDesc field of MIB2.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_LWIP_MIB2_SYSDESC || defined __DOXYGEN__
|
||||||
|
#define SNMP_LWIP_MIB2_SYSDESC "lwIP"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value return for sysName field of MIB2.
|
||||||
|
* To make sysName field settable, call snmp_mib2_set_sysname() to provide the necessary buffers.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_LWIP_MIB2_SYSNAME || defined __DOXYGEN__
|
||||||
|
#define SNMP_LWIP_MIB2_SYSNAME "FQDN-unk"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value return for sysContact field of MIB2.
|
||||||
|
* To make sysContact field settable, call snmp_mib2_set_syscontact() to provide the necessary buffers.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_LWIP_MIB2_SYSCONTACT || defined __DOXYGEN__
|
||||||
|
#define SNMP_LWIP_MIB2_SYSCONTACT ""
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value return for sysLocation field of MIB2.
|
||||||
|
* To make sysLocation field settable, call snmp_mib2_set_syslocation() to provide the necessary buffers.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_LWIP_MIB2_SYSLOCATION || defined __DOXYGEN__
|
||||||
|
#define SNMP_LWIP_MIB2_SYSLOCATION ""
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is used to limit the repetitions processed in GetBulk requests (value == 0 means no limitation).
|
||||||
|
* This may be useful to limit the load for a single request.
|
||||||
|
* According to SNMP RFC 1905 it is allowed to not return all requested variables from a GetBulk request if system load would be too high.
|
||||||
|
* so the effect is that the client will do more requests to gather all data.
|
||||||
|
* For the stack this could be useful in case that SNMP processing is done in TCP/IP thread. In this situation a request with many
|
||||||
|
* repetitions could block the thread for a longer time. Setting limit here will keep the stack more responsive.
|
||||||
|
*/
|
||||||
|
#if !defined SNMP_LWIP_GETBULK_MAX_REPETITIONS || defined __DOXYGEN__
|
||||||
|
#define SNMP_LWIP_GETBULK_MAX_REPETITIONS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
------------------------------------
|
||||||
|
---------- SNMPv3 options ----------
|
||||||
|
------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LWIP_SNMP_V3==1: This enables EXPERIMENTAL SNMPv3 support. LWIP_SNMP must
|
||||||
|
* also be enabled.
|
||||||
|
* THIS IS UNDER DEVELOPMENT AND SHOULD NOT BE ENABLED IN PRODUCTS.
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_SNMP_V3
|
||||||
|
#define LWIP_SNMP_V3 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LWIP_SNMP_V3_MBEDTLS
|
||||||
|
#define LWIP_SNMP_V3_MBEDTLS LWIP_SNMP_V3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LWIP_SNMP_V3_CRYPTO
|
||||||
|
#define LWIP_SNMP_V3_CRYPTO LWIP_SNMP_V3_MBEDTLS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LWIP_SNMP_CONFIGURE_VERSIONS
|
||||||
|
#define LWIP_SNMP_CONFIGURE_VERSIONS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_SNMP_OPTS_H */
|
||||||
+113
@@ -0,0 +1,113 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* SNMP server MIB API to implement scalar nodes
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Martin Hentschel <info@cl-soft.de>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_APPS_SNMP_SCALAR_H
|
||||||
|
#define LWIP_HDR_APPS_SNMP_SCALAR_H
|
||||||
|
|
||||||
|
#include "lwip/apps/snmp_opts.h"
|
||||||
|
#include "lwip/apps/snmp_core.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
/** basic scalar node */
|
||||||
|
struct snmp_scalar_node
|
||||||
|
{
|
||||||
|
/** inherited "base class" members */
|
||||||
|
struct snmp_leaf_node node;
|
||||||
|
u8_t asn1_type;
|
||||||
|
snmp_access_t access;
|
||||||
|
node_instance_get_value_method get_value;
|
||||||
|
node_instance_set_test_method set_test;
|
||||||
|
node_instance_set_value_method set_value;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
snmp_err_t snmp_scalar_get_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
|
||||||
|
snmp_err_t snmp_scalar_get_next_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
|
||||||
|
|
||||||
|
#define SNMP_SCALAR_CREATE_NODE(oid, access, asn1_type, get_value_method, set_test_method, set_value_method) \
|
||||||
|
{{{ SNMP_NODE_SCALAR, (oid) }, \
|
||||||
|
snmp_scalar_get_instance, \
|
||||||
|
snmp_scalar_get_next_instance }, \
|
||||||
|
(asn1_type), (access), (get_value_method), (set_test_method), (set_value_method) }
|
||||||
|
|
||||||
|
#define SNMP_SCALAR_CREATE_NODE_READONLY(oid, asn1_type, get_value_method) SNMP_SCALAR_CREATE_NODE(oid, SNMP_NODE_INSTANCE_READ_ONLY, asn1_type, get_value_method, NULL, NULL)
|
||||||
|
|
||||||
|
/** scalar array node - a tree node which contains scalars only as children */
|
||||||
|
struct snmp_scalar_array_node_def
|
||||||
|
{
|
||||||
|
u32_t oid;
|
||||||
|
u8_t asn1_type;
|
||||||
|
snmp_access_t access;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef s16_t (*snmp_scalar_array_get_value_method)(const struct snmp_scalar_array_node_def*, void*);
|
||||||
|
typedef snmp_err_t (*snmp_scalar_array_set_test_method)(const struct snmp_scalar_array_node_def*, u16_t, void*);
|
||||||
|
typedef snmp_err_t (*snmp_scalar_array_set_value_method)(const struct snmp_scalar_array_node_def*, u16_t, void*);
|
||||||
|
|
||||||
|
/** basic scalar array node */
|
||||||
|
struct snmp_scalar_array_node
|
||||||
|
{
|
||||||
|
/** inherited "base class" members */
|
||||||
|
struct snmp_leaf_node node;
|
||||||
|
u16_t array_node_count;
|
||||||
|
const struct snmp_scalar_array_node_def* array_nodes;
|
||||||
|
snmp_scalar_array_get_value_method get_value;
|
||||||
|
snmp_scalar_array_set_test_method set_test;
|
||||||
|
snmp_scalar_array_set_value_method set_value;
|
||||||
|
};
|
||||||
|
|
||||||
|
snmp_err_t snmp_scalar_array_get_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
|
||||||
|
snmp_err_t snmp_scalar_array_get_next_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
|
||||||
|
|
||||||
|
#define SNMP_SCALAR_CREATE_ARRAY_NODE(oid, array_nodes, get_value_method, set_test_method, set_value_method) \
|
||||||
|
{{{ SNMP_NODE_SCALAR_ARRAY, (oid) }, \
|
||||||
|
snmp_scalar_array_get_instance, \
|
||||||
|
snmp_scalar_array_get_next_instance }, \
|
||||||
|
(u16_t)LWIP_ARRAYSIZE(array_nodes), (array_nodes), (get_value_method), (set_test_method), (set_value_method) }
|
||||||
|
|
||||||
|
#endif /* LWIP_SNMP */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_SNMP_SCALAR_H */
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
Generated by LwipMibCompiler
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_APPS_SNMP_FRAMEWORK_MIB_H
|
||||||
|
#define LWIP_HDR_APPS_SNMP_FRAMEWORK_MIB_H
|
||||||
|
|
||||||
|
#include "lwip/apps/snmp_opts.h"
|
||||||
|
#if LWIP_SNMP
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#include "lwip/apps/snmp_core.h"
|
||||||
|
|
||||||
|
extern const struct snmp_obj_id usmNoAuthProtocol;
|
||||||
|
extern const struct snmp_obj_id usmHMACMD5AuthProtocol;
|
||||||
|
extern const struct snmp_obj_id usmHMACSHAAuthProtocol;
|
||||||
|
|
||||||
|
extern const struct snmp_obj_id usmNoPrivProtocol;
|
||||||
|
extern const struct snmp_obj_id usmDESPrivProtocol;
|
||||||
|
extern const struct snmp_obj_id usmAESPrivProtocol;
|
||||||
|
|
||||||
|
extern const struct snmp_mib snmpframeworkmib;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* LWIP_SNMP */
|
||||||
|
#endif /* LWIP_HDR_APPS_SNMP_FRAMEWORK_MIB_H */
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
Generated by LwipMibCompiler
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_APPS_SNMP_USER_BASED_SM_MIB_H
|
||||||
|
#define LWIP_HDR_APPS_SNMP_USER_BASED_SM_MIB_H
|
||||||
|
|
||||||
|
#include "lwip/apps/snmp_opts.h"
|
||||||
|
#if LWIP_SNMP
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#include "lwip/apps/snmp_core.h"
|
||||||
|
|
||||||
|
extern const struct snmp_mib snmpusmmib;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* LWIP_SNMP */
|
||||||
|
#endif /* LWIP_HDR_APPS_SNMP_USER_BASED_SM_MIB_H */
|
||||||
+134
@@ -0,0 +1,134 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* SNMP server MIB API to implement table nodes
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Martin Hentschel <info@cl-soft.de>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_APPS_SNMP_TABLE_H
|
||||||
|
#define LWIP_HDR_APPS_SNMP_TABLE_H
|
||||||
|
|
||||||
|
#include "lwip/apps/snmp_opts.h"
|
||||||
|
#include "lwip/apps/snmp_core.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
/** default (customizable) read/write table */
|
||||||
|
struct snmp_table_col_def
|
||||||
|
{
|
||||||
|
u32_t index;
|
||||||
|
u8_t asn1_type;
|
||||||
|
snmp_access_t access;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** table node */
|
||||||
|
struct snmp_table_node
|
||||||
|
{
|
||||||
|
/** inherited "base class" members */
|
||||||
|
struct snmp_leaf_node node;
|
||||||
|
u16_t column_count;
|
||||||
|
const struct snmp_table_col_def* columns;
|
||||||
|
snmp_err_t (*get_cell_instance)(const u32_t* column, const u32_t* row_oid, u8_t row_oid_len, struct snmp_node_instance* cell_instance);
|
||||||
|
snmp_err_t (*get_next_cell_instance)(const u32_t* column, struct snmp_obj_id* row_oid, struct snmp_node_instance* cell_instance);
|
||||||
|
/** returns object value for the given object identifier */
|
||||||
|
node_instance_get_value_method get_value;
|
||||||
|
/** tests length and/or range BEFORE setting */
|
||||||
|
node_instance_set_test_method set_test;
|
||||||
|
/** sets object value, only called when set_test() was successful */
|
||||||
|
node_instance_set_value_method set_value;
|
||||||
|
};
|
||||||
|
|
||||||
|
snmp_err_t snmp_table_get_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
|
||||||
|
snmp_err_t snmp_table_get_next_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
|
||||||
|
|
||||||
|
#define SNMP_TABLE_CREATE(oid, columns, get_cell_instance_method, get_next_cell_instance_method, get_value_method, set_test_method, set_value_method) \
|
||||||
|
{{{ SNMP_NODE_TABLE, (oid) }, \
|
||||||
|
snmp_table_get_instance, \
|
||||||
|
snmp_table_get_next_instance }, \
|
||||||
|
(u16_t)LWIP_ARRAYSIZE(columns), (columns), \
|
||||||
|
(get_cell_instance_method), (get_next_cell_instance_method), \
|
||||||
|
(get_value_method), (set_test_method), (set_value_method)}
|
||||||
|
|
||||||
|
#define SNMP_TABLE_GET_COLUMN_FROM_OID(oid) ((oid)[1]) /* first array value is (fixed) row entry (fixed to 1) and 2nd value is column, follow3ed by instance */
|
||||||
|
|
||||||
|
|
||||||
|
/** simple read-only table */
|
||||||
|
typedef enum {
|
||||||
|
SNMP_VARIANT_VALUE_TYPE_U32,
|
||||||
|
SNMP_VARIANT_VALUE_TYPE_S32,
|
||||||
|
SNMP_VARIANT_VALUE_TYPE_PTR,
|
||||||
|
SNMP_VARIANT_VALUE_TYPE_CONST_PTR
|
||||||
|
} snmp_table_column_data_type_t;
|
||||||
|
|
||||||
|
struct snmp_table_simple_col_def
|
||||||
|
{
|
||||||
|
u32_t index;
|
||||||
|
u8_t asn1_type;
|
||||||
|
snmp_table_column_data_type_t data_type; /* depending of what union member is used to store the value*/
|
||||||
|
};
|
||||||
|
|
||||||
|
/** simple read-only table node */
|
||||||
|
struct snmp_table_simple_node
|
||||||
|
{
|
||||||
|
/* inherited "base class" members */
|
||||||
|
struct snmp_leaf_node node;
|
||||||
|
u16_t column_count;
|
||||||
|
const struct snmp_table_simple_col_def* columns;
|
||||||
|
snmp_err_t (*get_cell_value)(const u32_t* column, const u32_t* row_oid, u8_t row_oid_len, union snmp_variant_value* value, u32_t* value_len);
|
||||||
|
snmp_err_t (*get_next_cell_instance_and_value)(const u32_t* column, struct snmp_obj_id* row_oid, union snmp_variant_value* value, u32_t* value_len);
|
||||||
|
};
|
||||||
|
|
||||||
|
snmp_err_t snmp_table_simple_get_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
|
||||||
|
snmp_err_t snmp_table_simple_get_next_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
|
||||||
|
|
||||||
|
#define SNMP_TABLE_CREATE_SIMPLE(oid, columns, get_cell_value_method, get_next_cell_instance_and_value_method) \
|
||||||
|
{{{ SNMP_NODE_TABLE, (oid) }, \
|
||||||
|
snmp_table_simple_get_instance, \
|
||||||
|
snmp_table_simple_get_next_instance }, \
|
||||||
|
(u16_t)LWIP_ARRAYSIZE(columns), (columns), (get_cell_value_method), (get_next_cell_instance_and_value_method) }
|
||||||
|
|
||||||
|
s16_t snmp_table_extract_value_from_s32ref(struct snmp_node_instance* instance, void* value);
|
||||||
|
s16_t snmp_table_extract_value_from_u32ref(struct snmp_node_instance* instance, void* value);
|
||||||
|
s16_t snmp_table_extract_value_from_refconstptr(struct snmp_node_instance* instance, void* value);
|
||||||
|
|
||||||
|
#endif /* LWIP_SNMP */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_SNMP_TABLE_H */
|
||||||
+114
@@ -0,0 +1,114 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* SNMP server MIB API to implement thread synchronization
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Dirk Ziegelmeier <dziegel@gmx.de>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_APPS_SNMP_THREADSYNC_H
|
||||||
|
#define LWIP_HDR_APPS_SNMP_THREADSYNC_H
|
||||||
|
|
||||||
|
#include "lwip/apps/snmp_opts.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
#include "lwip/apps/snmp_core.h"
|
||||||
|
#include "lwip/sys.h"
|
||||||
|
|
||||||
|
typedef void (*snmp_threadsync_called_fn)(void* arg);
|
||||||
|
typedef void (*snmp_threadsync_synchronizer_fn)(snmp_threadsync_called_fn fn, void* arg);
|
||||||
|
|
||||||
|
|
||||||
|
/** Thread sync runtime data. For internal usage only. */
|
||||||
|
struct threadsync_data
|
||||||
|
{
|
||||||
|
union {
|
||||||
|
snmp_err_t err;
|
||||||
|
s16_t s16;
|
||||||
|
} retval;
|
||||||
|
union {
|
||||||
|
const u32_t *root_oid;
|
||||||
|
void *value;
|
||||||
|
} arg1;
|
||||||
|
union {
|
||||||
|
u8_t root_oid_len;
|
||||||
|
u16_t len;
|
||||||
|
} arg2;
|
||||||
|
const struct snmp_threadsync_node *threadsync_node;
|
||||||
|
struct snmp_node_instance proxy_instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Thread sync instance. Needed EXACTLY once for every thread to be synced into. */
|
||||||
|
struct snmp_threadsync_instance
|
||||||
|
{
|
||||||
|
sys_sem_t sem;
|
||||||
|
sys_mutex_t sem_usage_mutex;
|
||||||
|
snmp_threadsync_synchronizer_fn sync_fn;
|
||||||
|
struct threadsync_data data;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** SNMP thread sync proxy leaf node */
|
||||||
|
struct snmp_threadsync_node
|
||||||
|
{
|
||||||
|
/* inherited "base class" members */
|
||||||
|
struct snmp_leaf_node node;
|
||||||
|
|
||||||
|
const struct snmp_leaf_node *target;
|
||||||
|
struct snmp_threadsync_instance *instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
snmp_err_t snmp_threadsync_get_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
|
||||||
|
snmp_err_t snmp_threadsync_get_next_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance);
|
||||||
|
|
||||||
|
/** Create thread sync proxy node */
|
||||||
|
#define SNMP_CREATE_THREAD_SYNC_NODE(oid, target_leaf_node, threadsync_instance) \
|
||||||
|
{{{ SNMP_NODE_THREADSYNC, (oid) }, \
|
||||||
|
snmp_threadsync_get_instance, \
|
||||||
|
snmp_threadsync_get_next_instance }, \
|
||||||
|
(target_leaf_node), \
|
||||||
|
(threadsync_instance) }
|
||||||
|
|
||||||
|
/** Create thread sync instance data */
|
||||||
|
void snmp_threadsync_init(struct snmp_threadsync_instance *instance, snmp_threadsync_synchronizer_fn sync_fn);
|
||||||
|
|
||||||
|
#endif /* LWIP_SNMP */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_SNMP_THREADSYNC_H */
|
||||||
+114
@@ -0,0 +1,114 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Additional SNMPv3 functionality RFC3414 and RFC3826.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Elias Oenal.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Author: Elias Oenal <lwip@eliasoenal.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_APPS_SNMP_V3_H
|
||||||
|
#define LWIP_HDR_APPS_SNMP_V3_H
|
||||||
|
|
||||||
|
#include "lwip/apps/snmp_opts.h"
|
||||||
|
#include "lwip/err.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LWIP_SNMP && LWIP_SNMP_V3
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
SNMP_V3_AUTH_ALGO_INVAL = 0,
|
||||||
|
SNMP_V3_AUTH_ALGO_MD5 = 1,
|
||||||
|
SNMP_V3_AUTH_ALGO_SHA = 2
|
||||||
|
} snmpv3_auth_algo_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
SNMP_V3_PRIV_ALGO_INVAL = 0,
|
||||||
|
SNMP_V3_PRIV_ALGO_DES = 1,
|
||||||
|
SNMP_V3_PRIV_ALGO_AES = 2
|
||||||
|
} snmpv3_priv_algo_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
SNMP_V3_USER_STORAGETYPE_OTHER = 1,
|
||||||
|
SNMP_V3_USER_STORAGETYPE_VOLATILE = 2,
|
||||||
|
SNMP_V3_USER_STORAGETYPE_NONVOLATILE = 3,
|
||||||
|
SNMP_V3_USER_STORAGETYPE_PERMANENT = 4,
|
||||||
|
SNMP_V3_USER_STORAGETYPE_READONLY = 5
|
||||||
|
} snmpv3_user_storagetype_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following callback functions must be implemented by the application.
|
||||||
|
* There is a dummy implementation in snmpv3_dummy.c.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void snmpv3_get_engine_id(const char **id, u8_t *len);
|
||||||
|
err_t snmpv3_set_engine_id(const char* id, u8_t len);
|
||||||
|
|
||||||
|
u32_t snmpv3_get_engine_boots(void);
|
||||||
|
void snmpv3_set_engine_boots(u32_t boots);
|
||||||
|
|
||||||
|
u32_t snmpv3_get_engine_time(void);
|
||||||
|
void snmpv3_reset_engine_time(void);
|
||||||
|
|
||||||
|
err_t snmpv3_get_user(const char* username, snmpv3_auth_algo_t *auth_algo, u8_t *auth_key, snmpv3_priv_algo_t *priv_algo, u8_t *priv_key);
|
||||||
|
u8_t snmpv3_get_amount_of_users(void);
|
||||||
|
err_t snmpv3_get_user_storagetype(const char *username, snmpv3_user_storagetype_t *storagetype);
|
||||||
|
err_t snmpv3_get_username(char *username, u8_t index);
|
||||||
|
|
||||||
|
/* The following functions are provided by the SNMPv3 agent */
|
||||||
|
|
||||||
|
void snmpv3_engine_id_changed(void);
|
||||||
|
s32_t snmpv3_get_engine_time_internal(void);
|
||||||
|
|
||||||
|
void snmpv3_password_to_key_md5(
|
||||||
|
const u8_t *password, /* IN */
|
||||||
|
size_t passwordlen, /* IN */
|
||||||
|
const u8_t *engineID, /* IN - pointer to snmpEngineID */
|
||||||
|
u8_t engineLength, /* IN - length of snmpEngineID */
|
||||||
|
u8_t *key); /* OUT - pointer to caller 16-octet buffer */
|
||||||
|
|
||||||
|
void snmpv3_password_to_key_sha(
|
||||||
|
const u8_t *password, /* IN */
|
||||||
|
size_t passwordlen, /* IN */
|
||||||
|
const u8_t *engineID, /* IN - pointer to snmpEngineID */
|
||||||
|
u8_t engineLength, /* IN - length of snmpEngineID */
|
||||||
|
u8_t *key); /* OUT - pointer to caller 20-octet buffer */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_SNMP_V3_H */
|
||||||
+80
@@ -0,0 +1,80 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* SNTP client API
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007-2009 Frédéric Bernon, Simon Goldschmidt
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Frédéric Bernon, Simon Goldschmidt
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_APPS_SNTP_H
|
||||||
|
#define LWIP_HDR_APPS_SNTP_H
|
||||||
|
|
||||||
|
#include "lwip/apps/sntp_opts.h"
|
||||||
|
#include "lwip/ip_addr.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* SNTP operating modes: default is to poll using unicast.
|
||||||
|
The mode has to be set before calling sntp_init(). */
|
||||||
|
#define SNTP_OPMODE_POLL 0
|
||||||
|
#define SNTP_OPMODE_LISTENONLY 1
|
||||||
|
void sntp_setoperatingmode(u8_t operating_mode);
|
||||||
|
u8_t sntp_getoperatingmode(void);
|
||||||
|
|
||||||
|
void sntp_init(void);
|
||||||
|
void sntp_stop(void);
|
||||||
|
u8_t sntp_enabled(void);
|
||||||
|
|
||||||
|
void sntp_setserver(u8_t idx, const ip_addr_t *addr);
|
||||||
|
const ip_addr_t* sntp_getserver(u8_t idx);
|
||||||
|
|
||||||
|
#if SNTP_MONITOR_SERVER_REACHABILITY
|
||||||
|
u8_t sntp_getreachability(u8_t idx);
|
||||||
|
#endif /* SNTP_MONITOR_SERVER_REACHABILITY */
|
||||||
|
|
||||||
|
#if SNTP_SERVER_DNS
|
||||||
|
void sntp_setservername(u8_t idx, const char *server);
|
||||||
|
const char *sntp_getservername(u8_t idx);
|
||||||
|
#endif /* SNTP_SERVER_DNS */
|
||||||
|
|
||||||
|
#if SNTP_GET_SERVERS_FROM_DHCP || SNTP_GET_SERVERS_FROM_DHCPV6
|
||||||
|
void sntp_servermode_dhcp(int set_servers_from_dhcp);
|
||||||
|
#else /* SNTP_GET_SERVERS_FROM_DHCP || SNTP_GET_SERVERS_FROM_DHCPV6 */
|
||||||
|
#define sntp_servermode_dhcp(x)
|
||||||
|
#endif /* SNTP_GET_SERVERS_FROM_DHCP || SNTP_GET_SERVERS_FROM_DHCPV6 */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_SNTP_H */
|
||||||
+215
@@ -0,0 +1,215 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* SNTP client options list
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007-2009 Frédéric Bernon, Simon Goldschmidt
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Frédéric Bernon, Simon Goldschmidt
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_APPS_SNTP_OPTS_H
|
||||||
|
#define LWIP_HDR_APPS_SNTP_OPTS_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
#include "lwip/prot/iana.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup sntp_opts Options
|
||||||
|
* @ingroup sntp
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** SNTP macro to change system time in seconds
|
||||||
|
* Define SNTP_SET_SYSTEM_TIME_US(sec, us) to set the time in microseconds
|
||||||
|
* instead of this one if you need the additional precision. Alternatively,
|
||||||
|
* define SNTP_SET_SYSTEM_TIME_NTP(sec, frac) in order to work with native
|
||||||
|
* NTP timestamps instead.
|
||||||
|
*/
|
||||||
|
#if !defined SNTP_SET_SYSTEM_TIME || defined __DOXYGEN__
|
||||||
|
#define SNTP_SET_SYSTEM_TIME(sec) LWIP_UNUSED_ARG(sec)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** The maximum number of SNTP servers that can be set */
|
||||||
|
#if !defined SNTP_MAX_SERVERS || defined __DOXYGEN__
|
||||||
|
#define SNTP_MAX_SERVERS LWIP_DHCP_MAX_NTP_SERVERS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to implement the callback function called by dhcp when
|
||||||
|
* NTP servers are received. */
|
||||||
|
#if !defined SNTP_GET_SERVERS_FROM_DHCP || defined __DOXYGEN__
|
||||||
|
#define SNTP_GET_SERVERS_FROM_DHCP LWIP_DHCP_GET_NTP_SRV
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to implement the callback function called by dhcpv6 when
|
||||||
|
* NTP servers are received. */
|
||||||
|
#if !defined SNTP_GET_SERVERS_FROM_DHCPV6 || defined __DOXYGEN__
|
||||||
|
#define SNTP_GET_SERVERS_FROM_DHCPV6 LWIP_DHCP6_GET_NTP_SRV
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set this to 1 to support DNS names (or IP address strings) to set sntp servers
|
||||||
|
* One server address/name can be defined as default if SNTP_SERVER_DNS == 1:
|
||||||
|
* \#define SNTP_SERVER_ADDRESS "pool.ntp.org"
|
||||||
|
*/
|
||||||
|
#if !defined SNTP_SERVER_DNS || defined __DOXYGEN__
|
||||||
|
#define SNTP_SERVER_DNS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SNTP_DEBUG: Enable debugging for SNTP.
|
||||||
|
*/
|
||||||
|
#if !defined SNTP_DEBUG || defined __DOXYGEN__
|
||||||
|
#define SNTP_DEBUG LWIP_DBG_OFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** SNTP server port */
|
||||||
|
#if !defined SNTP_PORT || defined __DOXYGEN__
|
||||||
|
#define SNTP_PORT LWIP_IANA_PORT_SNTP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Sanity check:
|
||||||
|
* Define this to
|
||||||
|
* - 0 to turn off sanity checks (default; smaller code)
|
||||||
|
* - >= 1 to check address and port of the response packet to ensure the
|
||||||
|
* response comes from the server we sent the request to.
|
||||||
|
* - >= 2 to check returned Originate Timestamp against Transmit Timestamp
|
||||||
|
* sent to the server (to ensure response to older request).
|
||||||
|
* - >= 3 @todo: discard reply if any of the VN, Stratum, or Transmit Timestamp
|
||||||
|
* fields is 0 or the Mode field is not 4 (unicast) or 5 (broadcast).
|
||||||
|
* - >= 4 @todo: to check that the Root Delay and Root Dispersion fields are each
|
||||||
|
* greater than or equal to 0 and less than infinity, where infinity is
|
||||||
|
* currently a cozy number like one second. This check avoids using a
|
||||||
|
* server whose synchronization source has expired for a very long time.
|
||||||
|
*/
|
||||||
|
#if !defined SNTP_CHECK_RESPONSE || defined __DOXYGEN__
|
||||||
|
#define SNTP_CHECK_RESPONSE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Enable round-trip delay compensation.
|
||||||
|
* Compensate for the round-trip delay by calculating the clock offset from
|
||||||
|
* the originate, receive, transmit and destination timestamps, as per RFC.
|
||||||
|
*
|
||||||
|
* The calculation requires compiler support for 64-bit integers. Also, either
|
||||||
|
* SNTP_SET_SYSTEM_TIME_US or SNTP_SET_SYSTEM_TIME_NTP has to be implemented
|
||||||
|
* for setting the system clock with sub-second precision. Likewise, either
|
||||||
|
* SNTP_GET_SYSTEM_TIME or SNTP_GET_SYSTEM_TIME_NTP needs to be implemented
|
||||||
|
* with sub-second precision.
|
||||||
|
*
|
||||||
|
* Although not strictly required, it makes sense to combine this option with
|
||||||
|
* SNTP_CHECK_RESPONSE >= 2 for sanity-checking of the received timestamps.
|
||||||
|
* Also, in order for the round-trip calculation to work, the difference
|
||||||
|
* between the local clock and the NTP server clock must not be larger than
|
||||||
|
* about 34 years. If that limit is exceeded, the implementation will fall back
|
||||||
|
* to setting the clock without compensation. In order to ensure that the local
|
||||||
|
* clock is always within the permitted range for compensation, even at first
|
||||||
|
* try, it may be necessary to store at least the current year in non-volatile
|
||||||
|
* memory.
|
||||||
|
*/
|
||||||
|
#if !defined SNTP_COMP_ROUNDTRIP || defined __DOXYGEN__
|
||||||
|
#define SNTP_COMP_ROUNDTRIP 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** According to the RFC, this shall be a random delay
|
||||||
|
* between 1 and 5 minutes (in milliseconds) to prevent load peaks.
|
||||||
|
* This can be defined to a random generation function,
|
||||||
|
* which must return the delay in milliseconds as u32_t.
|
||||||
|
* Turned off by default.
|
||||||
|
*/
|
||||||
|
#if !defined SNTP_STARTUP_DELAY || defined __DOXYGEN__
|
||||||
|
#ifdef LWIP_RAND
|
||||||
|
#define SNTP_STARTUP_DELAY 1
|
||||||
|
#else
|
||||||
|
#define SNTP_STARTUP_DELAY 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** If you want the startup delay to be a function, define this
|
||||||
|
* to a function (including the brackets) and define SNTP_STARTUP_DELAY to 1.
|
||||||
|
*/
|
||||||
|
#if !defined SNTP_STARTUP_DELAY_FUNC || defined __DOXYGEN__
|
||||||
|
#define SNTP_STARTUP_DELAY_FUNC (LWIP_RAND() % 5000)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** SNTP receive timeout - in milliseconds
|
||||||
|
* Also used as retry timeout - this shouldn't be too low.
|
||||||
|
* Default is 15 seconds. Must not be beolw 15 seconds by specification (i.e. 15000)
|
||||||
|
*/
|
||||||
|
#if !defined SNTP_RECV_TIMEOUT || defined __DOXYGEN__
|
||||||
|
#define SNTP_RECV_TIMEOUT 15000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** SNTP update delay - in milliseconds
|
||||||
|
* Default is 1 hour. Must not be beolw 60 seconds by specification (i.e. 60000)
|
||||||
|
*/
|
||||||
|
#if !defined SNTP_UPDATE_DELAY || defined __DOXYGEN__
|
||||||
|
#define SNTP_UPDATE_DELAY 3600000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** SNTP macro to get system time, used with SNTP_CHECK_RESPONSE >= 2
|
||||||
|
* to send in request and compare in response. Also used for round-trip
|
||||||
|
* delay compensation if SNTP_COMP_ROUNDTRIP != 0.
|
||||||
|
* Alternatively, define SNTP_GET_SYSTEM_TIME_NTP(sec, frac) in order to
|
||||||
|
* work with native NTP timestamps instead.
|
||||||
|
*/
|
||||||
|
#if !defined SNTP_GET_SYSTEM_TIME || defined __DOXYGEN__
|
||||||
|
#define SNTP_GET_SYSTEM_TIME(sec, us) do { (sec) = 0; (us) = 0; } while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Default retry timeout (in milliseconds) if the response
|
||||||
|
* received is invalid.
|
||||||
|
* This is doubled with each retry until SNTP_RETRY_TIMEOUT_MAX is reached.
|
||||||
|
*/
|
||||||
|
#if !defined SNTP_RETRY_TIMEOUT || defined __DOXYGEN__
|
||||||
|
#define SNTP_RETRY_TIMEOUT SNTP_RECV_TIMEOUT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Maximum retry timeout (in milliseconds). */
|
||||||
|
#if !defined SNTP_RETRY_TIMEOUT_MAX || defined __DOXYGEN__
|
||||||
|
#define SNTP_RETRY_TIMEOUT_MAX (SNTP_RETRY_TIMEOUT * 10)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Increase retry timeout with every retry sent
|
||||||
|
* Default is on to conform to RFC.
|
||||||
|
*/
|
||||||
|
#if !defined SNTP_RETRY_TIMEOUT_EXP || defined __DOXYGEN__
|
||||||
|
#define SNTP_RETRY_TIMEOUT_EXP 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Keep a reachability shift register per server
|
||||||
|
* Default is on to conform to RFC.
|
||||||
|
*/
|
||||||
|
#if !defined SNTP_MONITOR_SERVER_REACHABILITY || defined __DOXYGEN__
|
||||||
|
#define SNTP_MONITOR_SERVER_REACHABILITY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_SNTP_OPTS_H */
|
||||||
+106
@@ -0,0 +1,106 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* @file tftp_opts.h
|
||||||
|
*
|
||||||
|
* @author Logan Gunthorpe <logang@deltatee.com>
|
||||||
|
*
|
||||||
|
* @brief Trivial File Transfer Protocol (RFC 1350) implementation options
|
||||||
|
*
|
||||||
|
* Copyright (c) Deltatee Enterprises Ltd. 2013
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification,are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||||
|
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||||
|
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Author: Logan Gunthorpe <logang@deltatee.com>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_APPS_TFTP_OPTS_H
|
||||||
|
#define LWIP_HDR_APPS_TFTP_OPTS_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
#include "lwip/prot/iana.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup tftp_opts Options
|
||||||
|
* @ingroup tftp
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable TFTP debug messages
|
||||||
|
*/
|
||||||
|
#if !defined TFTP_DEBUG || defined __DOXYGEN__
|
||||||
|
#define TFTP_DEBUG LWIP_DBG_OFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TFTP server port
|
||||||
|
*/
|
||||||
|
#if !defined TFTP_PORT || defined __DOXYGEN__
|
||||||
|
#define TFTP_PORT LWIP_IANA_PORT_TFTP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TFTP timeout
|
||||||
|
*/
|
||||||
|
#if !defined TFTP_TIMEOUT_MSECS || defined __DOXYGEN__
|
||||||
|
#define TFTP_TIMEOUT_MSECS 10000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Max. number of retries when a file is read from server
|
||||||
|
*/
|
||||||
|
#if !defined TFTP_MAX_RETRIES || defined __DOXYGEN__
|
||||||
|
#define TFTP_MAX_RETRIES 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TFTP timer cyclic interval
|
||||||
|
*/
|
||||||
|
#if !defined TFTP_TIMER_MSECS || defined __DOXYGEN__
|
||||||
|
#define TFTP_TIMER_MSECS (TFTP_TIMEOUT_MSECS / 10)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Max. length of TFTP filename
|
||||||
|
*/
|
||||||
|
#if !defined TFTP_MAX_FILENAME_LEN || defined __DOXYGEN__
|
||||||
|
#define TFTP_MAX_FILENAME_LEN 20
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Max. length of TFTP mode
|
||||||
|
*/
|
||||||
|
#if !defined TFTP_MAX_MODE_LEN || defined __DOXYGEN__
|
||||||
|
#define TFTP_MAX_MODE_LEN 7
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_TFTP_OPTS_H */
|
||||||
+95
@@ -0,0 +1,95 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* @file tftp_server.h
|
||||||
|
*
|
||||||
|
* @author Logan Gunthorpe <logang@deltatee.com>
|
||||||
|
*
|
||||||
|
* @brief Trivial File Transfer Protocol (RFC 1350)
|
||||||
|
*
|
||||||
|
* Copyright (c) Deltatee Enterprises Ltd. 2013
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification,are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||||
|
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||||
|
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Author: Logan Gunthorpe <logang@deltatee.com>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_APPS_TFTP_SERVER_H
|
||||||
|
#define LWIP_HDR_APPS_TFTP_SERVER_H
|
||||||
|
|
||||||
|
#include "lwip/apps/tftp_opts.h"
|
||||||
|
#include "lwip/err.h"
|
||||||
|
#include "lwip/pbuf.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** @ingroup tftp
|
||||||
|
* TFTP context containing callback functions for TFTP transfers
|
||||||
|
*/
|
||||||
|
struct tftp_context {
|
||||||
|
/**
|
||||||
|
* Open file for read/write.
|
||||||
|
* @param fname Filename
|
||||||
|
* @param mode Mode string from TFTP RFC 1350 (netascii, octet, mail)
|
||||||
|
* @param write Flag indicating read (0) or write (!= 0) access
|
||||||
|
* @returns File handle supplied to other functions
|
||||||
|
*/
|
||||||
|
void* (*open)(const char* fname, const char* mode, u8_t write);
|
||||||
|
/**
|
||||||
|
* Close file handle
|
||||||
|
* @param handle File handle returned by open()
|
||||||
|
*/
|
||||||
|
void (*close)(void* handle);
|
||||||
|
/**
|
||||||
|
* Read from file
|
||||||
|
* @param handle File handle returned by open()
|
||||||
|
* @param buf Target buffer to copy read data to
|
||||||
|
* @param bytes Number of bytes to copy to buf
|
||||||
|
* @returns >= 0: Success; < 0: Error
|
||||||
|
*/
|
||||||
|
int (*read)(void* handle, void* buf, int bytes);
|
||||||
|
/**
|
||||||
|
* Write to file
|
||||||
|
* @param handle File handle returned by open()
|
||||||
|
* @param pbuf PBUF adjusted such that payload pointer points
|
||||||
|
* to the beginning of write data. In other words,
|
||||||
|
* TFTP headers are stripped off.
|
||||||
|
* @returns >= 0: Success; < 0: Error
|
||||||
|
*/
|
||||||
|
int (*write)(void* handle, struct pbuf* p);
|
||||||
|
};
|
||||||
|
|
||||||
|
err_t tftp_init(const struct tftp_context* ctx);
|
||||||
|
void tftp_cleanup(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_APPS_TFTP_SERVER_H */
|
||||||
+393
@@ -0,0 +1,393 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Support for different processor and compiler architectures
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_ARCH_H
|
||||||
|
#define LWIP_HDR_ARCH_H
|
||||||
|
|
||||||
|
#ifndef LITTLE_ENDIAN
|
||||||
|
#define LITTLE_ENDIAN 1234
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef BIG_ENDIAN
|
||||||
|
#define BIG_ENDIAN 4321
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "arch/cc.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup compiler_abstraction Compiler/platform abstraction
|
||||||
|
* @ingroup sys_layer
|
||||||
|
* All defines related to this section must not be placed in lwipopts.h,
|
||||||
|
* but in arch/cc.h!
|
||||||
|
* If the compiler does not provide memset() this file must include a
|
||||||
|
* definition of it, or include a file which defines it.
|
||||||
|
* These options cannot be \#defined in lwipopts.h since they are not options
|
||||||
|
* of lwIP itself, but options of the lwIP port to your system.
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Define the byte order of the system.
|
||||||
|
* Needed for conversion of network data to host byte order.
|
||||||
|
* Allowed values: LITTLE_ENDIAN and BIG_ENDIAN
|
||||||
|
*/
|
||||||
|
#ifndef BYTE_ORDER
|
||||||
|
#define BYTE_ORDER LITTLE_ENDIAN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Define random number generator function of your system */
|
||||||
|
#ifdef __DOXYGEN__
|
||||||
|
#define LWIP_RAND() ((u32_t)rand())
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Platform specific diagnostic output.\n
|
||||||
|
* Note the default implementation pulls in printf, which may
|
||||||
|
* in turn pull in a lot of standard library code. In resource-constrained
|
||||||
|
* systems, this should be defined to something less resource-consuming.
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_PLATFORM_DIAG
|
||||||
|
#define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0)
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Platform specific assertion handling.\n
|
||||||
|
* Note the default implementation pulls in printf, fflush and abort, which may
|
||||||
|
* in turn pull in a lot of standard library code. In resource-constrained
|
||||||
|
* systems, this should be defined to something less resource-consuming.
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_PLATFORM_ASSERT
|
||||||
|
#define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d in %s\n", \
|
||||||
|
x, __LINE__, __FILE__); fflush(NULL); abort();} while(0)
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Define this to 1 in arch/cc.h of your port if you do not want to
|
||||||
|
* include stddef.h header to get size_t. You need to typedef size_t
|
||||||
|
* by yourself in this case.
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_NO_STDDEF_H
|
||||||
|
#define LWIP_NO_STDDEF_H 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !LWIP_NO_STDDEF_H
|
||||||
|
#include <stddef.h> /* for size_t */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Define this to 1 in arch/cc.h of your port if your compiler does not provide
|
||||||
|
* the stdint.h header. You need to typedef the generic types listed in
|
||||||
|
* lwip/arch.h yourself in this case (u8_t, u16_t...).
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_NO_STDINT_H
|
||||||
|
#define LWIP_NO_STDINT_H 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define generic types used in lwIP */
|
||||||
|
#if !LWIP_NO_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
/* stdint.h is C99 which should also provide support for 64-bit integers */
|
||||||
|
#if !defined(LWIP_HAVE_INT64) && defined(UINT64_MAX)
|
||||||
|
#define LWIP_HAVE_INT64 1
|
||||||
|
#endif
|
||||||
|
typedef uint8_t u8_t;
|
||||||
|
typedef int8_t s8_t;
|
||||||
|
typedef uint16_t u16_t;
|
||||||
|
typedef int16_t s16_t;
|
||||||
|
typedef uint32_t u32_t;
|
||||||
|
typedef int32_t s32_t;
|
||||||
|
#if LWIP_HAVE_INT64
|
||||||
|
typedef uint64_t u64_t;
|
||||||
|
typedef int64_t s64_t;
|
||||||
|
#endif
|
||||||
|
typedef uintptr_t mem_ptr_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Define this to 1 in arch/cc.h of your port if your compiler does not provide
|
||||||
|
* the inttypes.h header. You need to define the format strings listed in
|
||||||
|
* lwip/arch.h yourself in this case (X8_F, U16_F...).
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_NO_INTTYPES_H
|
||||||
|
#define LWIP_NO_INTTYPES_H 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define (sn)printf formatters for these lwIP types */
|
||||||
|
#if !LWIP_NO_INTTYPES_H
|
||||||
|
#include <inttypes.h>
|
||||||
|
#ifndef X8_F
|
||||||
|
#define X8_F "02" PRIx8
|
||||||
|
#endif
|
||||||
|
#ifndef U16_F
|
||||||
|
#define U16_F PRIu16
|
||||||
|
#endif
|
||||||
|
#ifndef S16_F
|
||||||
|
#define S16_F PRId16
|
||||||
|
#endif
|
||||||
|
#ifndef X16_F
|
||||||
|
#define X16_F PRIx16
|
||||||
|
#endif
|
||||||
|
#ifndef U32_F
|
||||||
|
#define U32_F PRIu32
|
||||||
|
#endif
|
||||||
|
#ifndef S32_F
|
||||||
|
#define S32_F PRId32
|
||||||
|
#endif
|
||||||
|
#ifndef X32_F
|
||||||
|
#define X32_F PRIx32
|
||||||
|
#endif
|
||||||
|
#ifndef SZT_F
|
||||||
|
#define SZT_F PRIuPTR
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Define this to 1 in arch/cc.h of your port if your compiler does not provide
|
||||||
|
* the limits.h header. You need to define the type limits yourself in this case
|
||||||
|
* (e.g. INT_MAX, SSIZE_MAX).
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_NO_LIMITS_H
|
||||||
|
#define LWIP_NO_LIMITS_H 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Include limits.h? */
|
||||||
|
#if !LWIP_NO_LIMITS_H
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Do we need to define ssize_t? This is a compatibility hack:
|
||||||
|
* Unfortunately, this type seems to be unavailable on some systems (even if
|
||||||
|
* sys/types or unistd.h are available).
|
||||||
|
* Being like that, we define it to 'int' if SSIZE_MAX is not defined.
|
||||||
|
*/
|
||||||
|
#ifdef SSIZE_MAX
|
||||||
|
/* If SSIZE_MAX is defined, unistd.h should provide the type as well */
|
||||||
|
#ifndef LWIP_NO_UNISTD_H
|
||||||
|
#define LWIP_NO_UNISTD_H 0
|
||||||
|
#endif
|
||||||
|
#if !LWIP_NO_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#else /* SSIZE_MAX */
|
||||||
|
//typedef int ssize_t;
|
||||||
|
#define SSIZE_MAX LONG_MAX
|
||||||
|
#endif /* SSIZE_MAX */
|
||||||
|
|
||||||
|
/* some maximum values needed in lwip code */
|
||||||
|
#define LWIP_UINT32_MAX 0xffffffff
|
||||||
|
|
||||||
|
/** Define this to 1 in arch/cc.h of your port if your compiler does not provide
|
||||||
|
* the ctype.h header. If ctype.h is available, a few character functions
|
||||||
|
* are mapped to the appropriate functions (lwip_islower, lwip_isdigit...), if
|
||||||
|
* not, a private implementation is provided.
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_NO_CTYPE_H
|
||||||
|
#define LWIP_NO_CTYPE_H 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LWIP_NO_CTYPE_H
|
||||||
|
#define lwip_in_range(c, lo, up) ((u8_t)(c) >= (lo) && (u8_t)(c) <= (up))
|
||||||
|
#define lwip_isdigit(c) lwip_in_range((c), '0', '9')
|
||||||
|
#define lwip_isxdigit(c) (lwip_isdigit(c) || lwip_in_range((c), 'a', 'f') || lwip_in_range((c), 'A', 'F'))
|
||||||
|
#define lwip_islower(c) lwip_in_range((c), 'a', 'z')
|
||||||
|
#define lwip_isspace(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || (c) == '\r' || (c) == '\t' || (c) == '\v')
|
||||||
|
#define lwip_isupper(c) lwip_in_range((c), 'A', 'Z')
|
||||||
|
#define lwip_tolower(c) (lwip_isupper(c) ? (c) - 'A' + 'a' : c)
|
||||||
|
#define lwip_toupper(c) (lwip_islower(c) ? (c) - 'a' + 'A' : c)
|
||||||
|
#else
|
||||||
|
#include <ctype.h>
|
||||||
|
#define lwip_isdigit(c) isdigit((unsigned char)(c))
|
||||||
|
#define lwip_isxdigit(c) isxdigit((unsigned char)(c))
|
||||||
|
#define lwip_islower(c) islower((unsigned char)(c))
|
||||||
|
#define lwip_isspace(c) isspace((unsigned char)(c))
|
||||||
|
#define lwip_isupper(c) isupper((unsigned char)(c))
|
||||||
|
#define lwip_tolower(c) tolower((unsigned char)(c))
|
||||||
|
#define lwip_toupper(c) toupper((unsigned char)(c))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** C++ const_cast<target_type>(val) equivalent to remove constness from a value (GCC -Wcast-qual) */
|
||||||
|
#ifndef LWIP_CONST_CAST
|
||||||
|
#define LWIP_CONST_CAST(target_type, val) ((target_type)((ptrdiff_t)val))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Get rid of alignment cast warnings (GCC -Wcast-align) */
|
||||||
|
#ifndef LWIP_ALIGNMENT_CAST
|
||||||
|
#define LWIP_ALIGNMENT_CAST(target_type, val) LWIP_CONST_CAST(target_type, val)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Get rid of warnings related to pointer-to-numeric and vice-versa casts,
|
||||||
|
* e.g. "conversion from 'u8_t' to 'void *' of greater size"
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_PTR_NUMERIC_CAST
|
||||||
|
#define LWIP_PTR_NUMERIC_CAST(target_type, val) LWIP_CONST_CAST(target_type, val)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Avoid warnings/errors related to implicitly casting away packed attributes by doing a explicit cast */
|
||||||
|
#ifndef LWIP_PACKED_CAST
|
||||||
|
#define LWIP_PACKED_CAST(target_type, val) LWIP_CONST_CAST(target_type, val)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Allocates a memory buffer of specified size that is of sufficient size to align
|
||||||
|
* its start address using LWIP_MEM_ALIGN.
|
||||||
|
* You can declare your own version here e.g. to enforce alignment without adding
|
||||||
|
* trailing padding bytes (see LWIP_MEM_ALIGN_BUFFER) or your own section placement
|
||||||
|
* requirements.\n
|
||||||
|
* e.g. if you use gcc and need 32 bit alignment:\n
|
||||||
|
* \#define LWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u8_t variable_name[size] \_\_attribute\_\_((aligned(4)))\n
|
||||||
|
* or more portable:\n
|
||||||
|
* \#define LWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u32_t variable_name[(size + sizeof(u32_t) - 1) / sizeof(u32_t)]
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_DECLARE_MEMORY_ALIGNED
|
||||||
|
#define LWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u8_t variable_name[LWIP_MEM_ALIGN_BUFFER(size)]
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Calculate memory size for an aligned buffer - returns the next highest
|
||||||
|
* multiple of MEM_ALIGNMENT (e.g. LWIP_MEM_ALIGN_SIZE(3) and
|
||||||
|
* LWIP_MEM_ALIGN_SIZE(4) will both yield 4 for MEM_ALIGNMENT == 4).
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_MEM_ALIGN_SIZE
|
||||||
|
#define LWIP_MEM_ALIGN_SIZE(size) (((size) + MEM_ALIGNMENT - 1U) & ~(MEM_ALIGNMENT-1U))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Calculate safe memory size for an aligned buffer when using an unaligned
|
||||||
|
* type as storage. This includes a safety-margin on (MEM_ALIGNMENT - 1) at the
|
||||||
|
* start (e.g. if buffer is u8_t[] and actual data will be u32_t*)
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_MEM_ALIGN_BUFFER
|
||||||
|
#define LWIP_MEM_ALIGN_BUFFER(size) (((size) + MEM_ALIGNMENT - 1U))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Align a memory pointer to the alignment defined by MEM_ALIGNMENT
|
||||||
|
* so that ADDR % MEM_ALIGNMENT == 0
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_MEM_ALIGN
|
||||||
|
#define LWIP_MEM_ALIGN(addr) ((void *)(((mem_ptr_t)(addr) + MEM_ALIGNMENT - 1) & ~(mem_ptr_t)(MEM_ALIGNMENT-1)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Packed structs support.
|
||||||
|
* Placed BEFORE declaration of a packed struct.\n
|
||||||
|
* For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
|
||||||
|
* A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
|
||||||
|
*/
|
||||||
|
#ifndef PACK_STRUCT_BEGIN
|
||||||
|
#define PACK_STRUCT_BEGIN
|
||||||
|
#endif /* PACK_STRUCT_BEGIN */
|
||||||
|
|
||||||
|
/** Packed structs support.
|
||||||
|
* Placed AFTER declaration of a packed struct.\n
|
||||||
|
* For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
|
||||||
|
* A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
|
||||||
|
*/
|
||||||
|
#ifndef PACK_STRUCT_END
|
||||||
|
#define PACK_STRUCT_END
|
||||||
|
#endif /* PACK_STRUCT_END */
|
||||||
|
|
||||||
|
/** Packed structs support.
|
||||||
|
* Placed between end of declaration of a packed struct and trailing semicolon.\n
|
||||||
|
* For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
|
||||||
|
* A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
|
||||||
|
*/
|
||||||
|
#ifndef PACK_STRUCT_STRUCT
|
||||||
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
|
#define PACK_STRUCT_STRUCT __attribute__((packed))
|
||||||
|
#else
|
||||||
|
#define PACK_STRUCT_STRUCT
|
||||||
|
#endif
|
||||||
|
#endif /* PACK_STRUCT_STRUCT */
|
||||||
|
|
||||||
|
/** Packed structs support.
|
||||||
|
* Wraps u32_t and u16_t members.\n
|
||||||
|
* For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
|
||||||
|
* A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
|
||||||
|
*/
|
||||||
|
#ifndef PACK_STRUCT_FIELD
|
||||||
|
#define PACK_STRUCT_FIELD(x) x
|
||||||
|
#endif /* PACK_STRUCT_FIELD */
|
||||||
|
|
||||||
|
/** Packed structs support.
|
||||||
|
* Wraps u8_t members, where some compilers warn that packing is not necessary.\n
|
||||||
|
* For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
|
||||||
|
* A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
|
||||||
|
*/
|
||||||
|
#ifndef PACK_STRUCT_FLD_8
|
||||||
|
#define PACK_STRUCT_FLD_8(x) PACK_STRUCT_FIELD(x)
|
||||||
|
#endif /* PACK_STRUCT_FLD_8 */
|
||||||
|
|
||||||
|
/** Packed structs support.
|
||||||
|
* Wraps members that are packed structs themselves, where some compilers warn that packing is not necessary.\n
|
||||||
|
* For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
|
||||||
|
* A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
|
||||||
|
*/
|
||||||
|
#ifndef PACK_STRUCT_FLD_S
|
||||||
|
#define PACK_STRUCT_FLD_S(x) PACK_STRUCT_FIELD(x)
|
||||||
|
#endif /* PACK_STRUCT_FLD_S */
|
||||||
|
|
||||||
|
/** PACK_STRUCT_USE_INCLUDES==1: Packed structs support using \#include files before and after struct to be packed.\n
|
||||||
|
* The file included BEFORE the struct is "arch/bpstruct.h".\n
|
||||||
|
* The file included AFTER the struct is "arch/epstruct.h".\n
|
||||||
|
* This can be used to implement struct packing on MS Visual C compilers, see
|
||||||
|
* the Win32 port in the lwIP contrib repository for reference.
|
||||||
|
* For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
|
||||||
|
* A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
|
||||||
|
*/
|
||||||
|
#ifdef __DOXYGEN__
|
||||||
|
#define PACK_STRUCT_USE_INCLUDES
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Eliminates compiler warning about unused arguments (GCC -Wextra -Wunused). */
|
||||||
|
#ifndef LWIP_UNUSED_ARG
|
||||||
|
#define LWIP_UNUSED_ARG(x) (void)x
|
||||||
|
#endif /* LWIP_UNUSED_ARG */
|
||||||
|
|
||||||
|
/** LWIP_PROVIDE_ERRNO==1: Let lwIP provide ERRNO values and the 'errno' variable.
|
||||||
|
* If this is disabled, cc.h must either define 'errno', include <errno.h>,
|
||||||
|
* define LWIP_ERRNO_STDINCLUDE to get <errno.h> included or
|
||||||
|
* define LWIP_ERRNO_INCLUDE to <errno.h> or equivalent.
|
||||||
|
*/
|
||||||
|
#if defined __DOXYGEN__
|
||||||
|
#define LWIP_PROVIDE_ERRNO
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_ARCH_H */
|
||||||
+99
@@ -0,0 +1,99 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
*
|
||||||
|
* AutoIP Automatic LinkLocal IP Configuration
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2007 Dominik Spies <kontakt@dspies.de>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Author: Dominik Spies <kontakt@dspies.de>
|
||||||
|
*
|
||||||
|
* This is a AutoIP implementation for the lwIP TCP/IP stack. It aims to conform
|
||||||
|
* with RFC 3927.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_AUTOIP_H
|
||||||
|
#define LWIP_HDR_AUTOIP_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if LWIP_IPV4 && LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
#include "lwip/netif.h"
|
||||||
|
/* #include "lwip/udp.h" */
|
||||||
|
#include "lwip/etharp.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** AutoIP Timing */
|
||||||
|
#define AUTOIP_TMR_INTERVAL 100
|
||||||
|
#define AUTOIP_TICKS_PER_SECOND (1000 / AUTOIP_TMR_INTERVAL)
|
||||||
|
|
||||||
|
/** AutoIP state information per netif */
|
||||||
|
struct autoip
|
||||||
|
{
|
||||||
|
/** the currently selected, probed, announced or used LL IP-Address */
|
||||||
|
ip4_addr_t llipaddr;
|
||||||
|
/** current AutoIP state machine state */
|
||||||
|
u8_t state;
|
||||||
|
/** sent number of probes or announces, dependent on state */
|
||||||
|
u8_t sent_num;
|
||||||
|
/** ticks to wait, tick is AUTOIP_TMR_INTERVAL long */
|
||||||
|
u16_t ttw;
|
||||||
|
/** ticks until a conflict can be solved by defending */
|
||||||
|
u8_t lastconflict;
|
||||||
|
/** total number of probed/used Link Local IP-Addresses */
|
||||||
|
u8_t tried_llipaddr;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void autoip_set_struct(struct netif *netif, struct autoip *autoip);
|
||||||
|
/** Remove a struct autoip previously set to the netif using autoip_set_struct() */
|
||||||
|
#define autoip_remove_struct(netif) do { (netif)->autoip = NULL; } while (0)
|
||||||
|
err_t autoip_start(struct netif *netif);
|
||||||
|
err_t autoip_stop(struct netif *netif);
|
||||||
|
void autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr);
|
||||||
|
void autoip_tmr(void);
|
||||||
|
void autoip_network_changed(struct netif *netif);
|
||||||
|
u8_t autoip_supplied_address(const struct netif *netif);
|
||||||
|
|
||||||
|
/* for lwIP internal use by ip4.c */
|
||||||
|
u8_t autoip_accept_packet(struct netif *netif, const ip4_addr_t *addr);
|
||||||
|
|
||||||
|
#define netif_autoip_data(netif) ((struct autoip*)netif_get_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP))
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_IPV4 && LWIP_AUTOIP */
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_AUTOIP_H */
|
||||||
+159
@@ -0,0 +1,159 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Debug messages infrastructure
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_DEBUG_H
|
||||||
|
#define LWIP_HDR_DEBUG_H
|
||||||
|
|
||||||
|
#include "lwip/arch.h"
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup debugging_levels LWIP_DBG_MIN_LEVEL and LWIP_DBG_TYPES_ON values
|
||||||
|
* @ingroup lwip_opts_debugmsg
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @name Debug level (LWIP_DBG_MIN_LEVEL)
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/** Debug level: ALL messages*/
|
||||||
|
#define LWIP_DBG_LEVEL_ALL 0x00
|
||||||
|
/** Debug level: Warnings. bad checksums, dropped packets, ... */
|
||||||
|
#define LWIP_DBG_LEVEL_WARNING 0x01
|
||||||
|
/** Debug level: Serious. memory allocation failures, ... */
|
||||||
|
#define LWIP_DBG_LEVEL_SERIOUS 0x02
|
||||||
|
/** Debug level: Severe */
|
||||||
|
#define LWIP_DBG_LEVEL_SEVERE 0x03
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LWIP_DBG_MASK_LEVEL 0x03
|
||||||
|
/* compatibility define only */
|
||||||
|
#define LWIP_DBG_LEVEL_OFF LWIP_DBG_LEVEL_ALL
|
||||||
|
|
||||||
|
/** @name Enable/disable debug messages completely (LWIP_DBG_TYPES_ON)
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/** flag for LWIP_DEBUGF to enable that debug message */
|
||||||
|
#define LWIP_DBG_ON 0x80U
|
||||||
|
/** flag for LWIP_DEBUGF to disable that debug message */
|
||||||
|
#define LWIP_DBG_OFF 0x00U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @name Debug message types (LWIP_DBG_TYPES_ON)
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/** flag for LWIP_DEBUGF indicating a tracing message (to follow program flow) */
|
||||||
|
#define LWIP_DBG_TRACE 0x40U
|
||||||
|
/** flag for LWIP_DEBUGF indicating a state debug message (to follow module states) */
|
||||||
|
#define LWIP_DBG_STATE 0x20U
|
||||||
|
/** flag for LWIP_DEBUGF indicating newly added code, not thoroughly tested yet */
|
||||||
|
#define LWIP_DBG_FRESH 0x10U
|
||||||
|
/** flag for LWIP_DEBUGF to halt after printing this debug message */
|
||||||
|
#define LWIP_DBG_HALT 0x08U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup lwip_assertions Assertion handling
|
||||||
|
* @ingroup lwip_opts_debug
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* LWIP_NOASSERT: Disable LWIP_ASSERT checks:
|
||||||
|
* To disable assertions define LWIP_NOASSERT in arch/cc.h.
|
||||||
|
*/
|
||||||
|
#ifdef __DOXYGEN__
|
||||||
|
#define LWIP_NOASSERT
|
||||||
|
#undef LWIP_NOASSERT
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_NOASSERT
|
||||||
|
#define LWIP_ASSERT(message, assertion) do { if (!(assertion)) { \
|
||||||
|
LWIP_PLATFORM_ASSERT(message); }} while(0)
|
||||||
|
#else /* LWIP_NOASSERT */
|
||||||
|
#define LWIP_ASSERT(message, assertion)
|
||||||
|
#endif /* LWIP_NOASSERT */
|
||||||
|
|
||||||
|
#ifndef LWIP_ERROR
|
||||||
|
#ifdef LWIP_DEBUG
|
||||||
|
#define LWIP_PLATFORM_ERROR(message) LWIP_PLATFORM_DIAG((message))
|
||||||
|
#else
|
||||||
|
#define LWIP_PLATFORM_ERROR(message)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* if "expression" isn't true, then print "message" and execute "handler" expression */
|
||||||
|
#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
|
||||||
|
LWIP_PLATFORM_ERROR(message); handler;}} while(0)
|
||||||
|
#endif /* LWIP_ERROR */
|
||||||
|
|
||||||
|
/** Enable debug message printing, but only if debug message type is enabled
|
||||||
|
* AND is of correct type AND is at least LWIP_DBG_LEVEL.
|
||||||
|
*/
|
||||||
|
#ifdef __DOXYGEN__
|
||||||
|
#define LWIP_DEBUG
|
||||||
|
#undef LWIP_DEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef LWIP_DEBUG
|
||||||
|
#define LWIP_DEBUGF(debug, message) do { \
|
||||||
|
if ( \
|
||||||
|
((debug) & LWIP_DBG_ON) && \
|
||||||
|
((debug) & LWIP_DBG_TYPES_ON) && \
|
||||||
|
((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { \
|
||||||
|
LWIP_PLATFORM_DIAG(message); \
|
||||||
|
if ((debug) & LWIP_DBG_HALT) { \
|
||||||
|
while(1); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#else /* LWIP_DEBUG */
|
||||||
|
#define LWIP_DEBUGF(debug, message)
|
||||||
|
#endif /* LWIP_DEBUG */
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_DEBUG_H */
|
||||||
+152
@@ -0,0 +1,152 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* various utility macros
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup perf Performance measurement
|
||||||
|
* @ingroup sys_layer
|
||||||
|
* All defines related to this section must not be placed in lwipopts.h,
|
||||||
|
* but in arch/perf.h!
|
||||||
|
* Measurement calls made throughout lwip, these can be defined to nothing.
|
||||||
|
* - PERF_START: start measuring something.
|
||||||
|
* - PERF_STOP(x): stop measuring something, and record the result.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_DEF_H
|
||||||
|
#define LWIP_HDR_DEF_H
|
||||||
|
|
||||||
|
/* arch.h might define NULL already */
|
||||||
|
#include "lwip/arch.h"
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
#if LWIP_PERF
|
||||||
|
#include "arch/perf.h"
|
||||||
|
#else /* LWIP_PERF */
|
||||||
|
#define PERF_START /* null definition */
|
||||||
|
#define PERF_STOP(x) /* null definition */
|
||||||
|
#endif /* LWIP_PERF */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define LWIP_MAX(x , y) (((x) > (y)) ? (x) : (y))
|
||||||
|
#define LWIP_MIN(x , y) (((x) < (y)) ? (x) : (y))
|
||||||
|
|
||||||
|
/* Get the number of entries in an array ('x' must NOT be a pointer!) */
|
||||||
|
#define LWIP_ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0]))
|
||||||
|
|
||||||
|
/** Create u32_t value from bytes */
|
||||||
|
#define LWIP_MAKEU32(a,b,c,d) (((u32_t)((a) & 0xff) << 24) | \
|
||||||
|
((u32_t)((b) & 0xff) << 16) | \
|
||||||
|
((u32_t)((c) & 0xff) << 8) | \
|
||||||
|
(u32_t)((d) & 0xff))
|
||||||
|
|
||||||
|
#ifndef NULL
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define NULL 0
|
||||||
|
#else
|
||||||
|
#define NULL ((void *)0)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BYTE_ORDER == BIG_ENDIAN
|
||||||
|
#define lwip_htons(x) ((u16_t)(x))
|
||||||
|
#define lwip_ntohs(x) ((u16_t)(x))
|
||||||
|
#define lwip_htonl(x) ((u32_t)(x))
|
||||||
|
#define lwip_ntohl(x) ((u32_t)(x))
|
||||||
|
#define PP_HTONS(x) ((u16_t)(x))
|
||||||
|
#define PP_NTOHS(x) ((u16_t)(x))
|
||||||
|
#define PP_HTONL(x) ((u32_t)(x))
|
||||||
|
#define PP_NTOHL(x) ((u32_t)(x))
|
||||||
|
#else /* BYTE_ORDER != BIG_ENDIAN */
|
||||||
|
#ifndef lwip_htons
|
||||||
|
u16_t lwip_htons(u16_t x);
|
||||||
|
#endif
|
||||||
|
#define lwip_ntohs(x) lwip_htons(x)
|
||||||
|
|
||||||
|
#ifndef lwip_htonl
|
||||||
|
u32_t lwip_htonl(u32_t x);
|
||||||
|
#endif
|
||||||
|
#define lwip_ntohl(x) lwip_htonl(x)
|
||||||
|
|
||||||
|
/* These macros should be calculated by the preprocessor and are used
|
||||||
|
with compile-time constants only (so that there is no little-endian
|
||||||
|
overhead at runtime). */
|
||||||
|
#define PP_HTONS(x) ((u16_t)((((x) & (u16_t)0x00ffU) << 8) | (((x) & (u16_t)0xff00U) >> 8)))
|
||||||
|
#define PP_NTOHS(x) PP_HTONS(x)
|
||||||
|
#define PP_HTONL(x) ((((x) & (u32_t)0x000000ffUL) << 24) | \
|
||||||
|
(((x) & (u32_t)0x0000ff00UL) << 8) | \
|
||||||
|
(((x) & (u32_t)0x00ff0000UL) >> 8) | \
|
||||||
|
(((x) & (u32_t)0xff000000UL) >> 24))
|
||||||
|
#define PP_NTOHL(x) PP_HTONL(x)
|
||||||
|
#endif /* BYTE_ORDER == BIG_ENDIAN */
|
||||||
|
|
||||||
|
/* Provide usual function names as macros for users, but this can be turned off */
|
||||||
|
#ifndef LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS
|
||||||
|
#define htons(x) lwip_htons(x)
|
||||||
|
#define ntohs(x) lwip_ntohs(x)
|
||||||
|
#define htonl(x) lwip_htonl(x)
|
||||||
|
#define ntohl(x) lwip_ntohl(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Functions that are not available as standard implementations.
|
||||||
|
* In cc.h, you can #define these to implementations available on
|
||||||
|
* your platform to save some code bytes if you use these functions
|
||||||
|
* in your application, too.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef lwip_itoa
|
||||||
|
/* This can be #defined to itoa() or snprintf(result, bufsize, "%d", number) depending on your platform */
|
||||||
|
void lwip_itoa(char* result, size_t bufsize, int number);
|
||||||
|
#endif
|
||||||
|
#ifndef lwip_strnicmp
|
||||||
|
/* This can be #defined to strnicmp() or strncasecmp() depending on your platform */
|
||||||
|
int lwip_strnicmp(const char* str1, const char* str2, size_t len);
|
||||||
|
#endif
|
||||||
|
#ifndef lwip_stricmp
|
||||||
|
/* This can be #defined to stricmp() or strcasecmp() depending on your platform */
|
||||||
|
int lwip_stricmp(const char* str1, const char* str2);
|
||||||
|
#endif
|
||||||
|
#ifndef lwip_strnstr
|
||||||
|
/* This can be #defined to strnstr() depending on your platform */
|
||||||
|
char* lwip_strnstr(const char* buffer, const char* token, size_t n);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_DEF_H */
|
||||||
+139
@@ -0,0 +1,139 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* DHCP client API
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2004 Leon Woestenberg <leon.woestenberg@gmx.net>
|
||||||
|
* Copyright (c) 2001-2004 Axon Digital Design B.V., The Netherlands.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Leon Woestenberg <leon.woestenberg@gmx.net>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef LWIP_HDR_DHCP_H
|
||||||
|
#define LWIP_HDR_DHCP_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if LWIP_DHCP /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
#include "lwip/netif.h"
|
||||||
|
#include "lwip/udp.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** period (in seconds) of the application calling dhcp_coarse_tmr() */
|
||||||
|
#define DHCP_COARSE_TIMER_SECS 60
|
||||||
|
/** period (in milliseconds) of the application calling dhcp_coarse_tmr() */
|
||||||
|
#define DHCP_COARSE_TIMER_MSECS (DHCP_COARSE_TIMER_SECS * 1000UL)
|
||||||
|
/** period (in milliseconds) of the application calling dhcp_fine_tmr() */
|
||||||
|
#define DHCP_FINE_TIMER_MSECS 500
|
||||||
|
|
||||||
|
#define DHCP_BOOT_FILE_LEN 128U
|
||||||
|
|
||||||
|
/* AutoIP cooperation flags (struct dhcp.autoip_coop_state) */
|
||||||
|
typedef enum {
|
||||||
|
DHCP_AUTOIP_COOP_STATE_OFF = 0,
|
||||||
|
DHCP_AUTOIP_COOP_STATE_ON = 1
|
||||||
|
} dhcp_autoip_coop_state_enum_t;
|
||||||
|
|
||||||
|
struct dhcp
|
||||||
|
{
|
||||||
|
/** transaction identifier of last sent request */
|
||||||
|
u32_t xid;
|
||||||
|
/** track PCB allocation state */
|
||||||
|
u8_t pcb_allocated;
|
||||||
|
/** current DHCP state machine state */
|
||||||
|
u8_t state;
|
||||||
|
/** retries of current request */
|
||||||
|
u8_t tries;
|
||||||
|
#if LWIP_DHCP_AUTOIP_COOP
|
||||||
|
u8_t autoip_coop_state;
|
||||||
|
#endif
|
||||||
|
u8_t subnet_mask_given;
|
||||||
|
|
||||||
|
u16_t request_timeout; /* #ticks with period DHCP_FINE_TIMER_SECS for request timeout */
|
||||||
|
u16_t t1_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for renewal time */
|
||||||
|
u16_t t2_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for rebind time */
|
||||||
|
u16_t t1_renew_time; /* #ticks with period DHCP_COARSE_TIMER_SECS until next renew try */
|
||||||
|
u16_t t2_rebind_time; /* #ticks with period DHCP_COARSE_TIMER_SECS until next rebind try */
|
||||||
|
u16_t lease_used; /* #ticks with period DHCP_COARSE_TIMER_SECS since last received DHCP ack */
|
||||||
|
u16_t t0_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for lease time */
|
||||||
|
ip_addr_t server_ip_addr; /* dhcp server address that offered this lease (ip_addr_t because passed to UDP) */
|
||||||
|
ip4_addr_t offered_ip_addr;
|
||||||
|
ip4_addr_t offered_sn_mask;
|
||||||
|
ip4_addr_t offered_gw_addr;
|
||||||
|
|
||||||
|
u32_t offered_t0_lease; /* lease period (in seconds) */
|
||||||
|
u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */
|
||||||
|
u32_t offered_t2_rebind; /* recommended rebind time (usually 87.5 of lease period) */
|
||||||
|
#if LWIP_DHCP_BOOTP_FILE
|
||||||
|
ip4_addr_t offered_si_addr;
|
||||||
|
char boot_file_name[DHCP_BOOT_FILE_LEN];
|
||||||
|
#endif /* LWIP_DHCP_BOOTPFILE */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void dhcp_set_struct(struct netif *netif, struct dhcp *dhcp);
|
||||||
|
/** Remove a struct dhcp previously set to the netif using dhcp_set_struct() */
|
||||||
|
#define dhcp_remove_struct(netif) netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_DHCP, NULL)
|
||||||
|
void dhcp_cleanup(struct netif *netif);
|
||||||
|
err_t dhcp_start(struct netif *netif);
|
||||||
|
err_t dhcp_renew(struct netif *netif);
|
||||||
|
err_t dhcp_release(struct netif *netif);
|
||||||
|
void dhcp_stop(struct netif *netif);
|
||||||
|
void dhcp_release_and_stop(struct netif *netif);
|
||||||
|
void dhcp_inform(struct netif *netif);
|
||||||
|
void dhcp_network_changed(struct netif *netif);
|
||||||
|
#if DHCP_DOES_ARP_CHECK
|
||||||
|
void dhcp_arp_reply(struct netif *netif, const ip4_addr_t *addr);
|
||||||
|
#endif
|
||||||
|
u8_t dhcp_supplied_address(const struct netif *netif);
|
||||||
|
/* to be called every minute */
|
||||||
|
void dhcp_coarse_tmr(void);
|
||||||
|
/* to be called every half second */
|
||||||
|
void dhcp_fine_tmr(void);
|
||||||
|
|
||||||
|
#if LWIP_DHCP_GET_NTP_SRV
|
||||||
|
/** This function must exist, in other to add offered NTP servers to
|
||||||
|
* the NTP (or SNTP) engine.
|
||||||
|
* See LWIP_DHCP_MAX_NTP_SERVERS */
|
||||||
|
extern void dhcp_set_ntp_servers(u8_t num_ntp_servers, const ip4_addr_t* ntp_server_addrs);
|
||||||
|
#endif /* LWIP_DHCP_GET_NTP_SRV */
|
||||||
|
|
||||||
|
#define netif_dhcp_data(netif) ((struct dhcp*)netif_get_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_DHCP))
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_DHCP */
|
||||||
|
|
||||||
|
#endif /*LWIP_HDR_DHCP_H*/
|
||||||
+104
@@ -0,0 +1,104 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
*
|
||||||
|
* DHCPv6 client: IPv6 address autoconfiguration as per
|
||||||
|
* RFC 3315 (stateful DHCPv6) and
|
||||||
|
* RFC 3736 (stateless DHCPv6).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Simon Goldschmidt
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
* OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
|
*
|
||||||
|
* Author: Simon Goldschmidt <goldsimon@gmx.de>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_HDR_IP6_DHCP6_H
|
||||||
|
#define LWIP_HDR_IP6_DHCP6_H
|
||||||
|
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
|
#if LWIP_IPV6_DHCP6 /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
|
#include "lwip/err.h"
|
||||||
|
#include "lwip/netif.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** period (in milliseconds) of the application calling dhcp6_tmr() */
|
||||||
|
#define DHCP6_TIMER_MSECS 500
|
||||||
|
|
||||||
|
struct dhcp6
|
||||||
|
{
|
||||||
|
/** transaction identifier of last sent request */
|
||||||
|
u32_t xid;
|
||||||
|
/** track PCB allocation state */
|
||||||
|
u8_t pcb_allocated;
|
||||||
|
/** current DHCPv6 state machine state */
|
||||||
|
u8_t state;
|
||||||
|
/** retries of current request */
|
||||||
|
u8_t tries;
|
||||||
|
/** if request config is triggered while another action is active, this keeps track of it */
|
||||||
|
u8_t request_config_pending;
|
||||||
|
/** #ticks with period DHCP6_TIMER_MSECS for request timeout */
|
||||||
|
u16_t request_timeout;
|
||||||
|
#if LWIP_IPV6_DHCP6_STATEFUL
|
||||||
|
/* @todo: add more members here to keep track of stateful DHCPv6 data, like lease times */
|
||||||
|
#endif /* LWIP_IPV6_DHCP6_STATEFUL */
|
||||||
|
};
|
||||||
|
|
||||||
|
void dhcp6_set_struct(struct netif *netif, struct dhcp6 *dhcp6);
|
||||||
|
/** Remove a struct dhcp6 previously set to the netif using dhcp6_set_struct() */
|
||||||
|
#define dhcp6_remove_struct(netif) netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_DHCP6, NULL)
|
||||||
|
void dhcp6_cleanup(struct netif *netif);
|
||||||
|
|
||||||
|
err_t dhcp6_enable_stateful(struct netif *netif);
|
||||||
|
err_t dhcp6_enable_stateless(struct netif *netif);
|
||||||
|
void dhcp6_disable(struct netif *netif);
|
||||||
|
|
||||||
|
void dhcp6_tmr(void);
|
||||||
|
|
||||||
|
void dhcp6_nd6_ra_trigger(struct netif *netif, u8_t managed_addr_config, u8_t other_config);
|
||||||
|
|
||||||
|
#if LWIP_DHCP6_GET_NTP_SRV
|
||||||
|
/** This function must exist, in other to add offered NTP servers to
|
||||||
|
* the NTP (or SNTP) engine.
|
||||||
|
* See LWIP_DHCP6_MAX_NTP_SERVERS */
|
||||||
|
extern void dhcp6_set_ntp_servers(u8_t num_ntp_servers, const ip_addr_t* ntp_server_addrs);
|
||||||
|
#endif /* LWIP_DHCP6_GET_NTP_SRV */
|
||||||
|
|
||||||
|
#define netif_dhcp6_data(netif) ((struct dhcp6*)netif_get_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_DHCP6))
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LWIP_IPV6_DHCP6 */
|
||||||
|
|
||||||
|
#endif /* LWIP_HDR_IP6_DHCP6_H */
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user