Skip to content

Commit

Permalink
Merge pull request #48 from MrKevinWeiss/pr/fixphilip
Browse files Browse the repository at this point in the history
Some fixes when porting maps to PHiLIP
  • Loading branch information
MrKevinWeiss authored Nov 15, 2022
2 parents 7cbe8a2 + 32e630c commit 9d98618
Show file tree
Hide file tree
Showing 17 changed files with 133 additions and 94 deletions.
8 changes: 8 additions & 0 deletions examples/philip/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
This is an example based of the [PHiLIP](https://github.com/riot-appstore/PHiLIP) project.

It contains a "real world" use of the map and some of the features.

To generate simply run:
```
mmm-gen
```
in this folder...
13 changes: 6 additions & 7 deletions examples/philip/adc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ bitfields:
typedefs:
adc_t:
description: Controls and reads the ADC
type_size: 32
total_size: 32
elements:
- description: Mode settings for the ADC
name: mode
Expand All @@ -24,29 +24,28 @@ typedefs:
max: 1048575
min: 0
name: num_of_samples
flag: VOLATILE
type: uint32_t
- access: read-only
- write_permission: null
description: Sample index increases when new sample read
name: index
type: uint32_t
flag: VOLATILE
- access: read-only
- write_permission: null
description: Current 12 bit sample value
name: sample
type: uint16_t
flag: VOLATILE
- access: read-only
- write_permission: null
description: Sum of the last num_of_samples
name: sum
type: uint32_t
flag: VOLATILE
- access: read-only
- write_permission: null
description: Current collection of the sums
name: current_sum
type: uint32_t
flag: VOLATILE
- access: read-only
- write_permission: null
description: Sum counter increases when available
name: counter
type: uint8_t
Expand Down
6 changes: 5 additions & 1 deletion examples/philip/dac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ typedefs:
description: The percent/100 of output level
name: level
type: uint16_t
type_size: 16
total_size: 16

overrides:
dac.dut_dac.level:
flag: VOLATILE
4 changes: 2 additions & 2 deletions examples/philip/gpio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bitfields:
gpio_status_t:
description: IO pin status
flag: VOLATILE
access: read-only
write_permission: null
elements:
- description: The io level of the pin - 0:low - 1:high
name: level
Expand All @@ -49,4 +49,4 @@ typedefs:
- description: The status of the GPIO
name: status
type: gpio_status_t
type_size: 4
total_size: 4
33 changes: 21 additions & 12 deletions examples/philip/i2c.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,28 @@ bitfields:

i2c_status_t:
description: I2C status
access: read-only
write_permission: null
elements:
- description: 'Overrun/Underrun: Request for new byte when not ready'
name: ovr
- description: Acknowledge failure
name: af
- description: 'Bus error: Non-valid position during a byte transfer'
name: berr
flag: VOLATILE
- description: General call address received
name: gencall
- description: i2c bus is BUSY
name: busy
flag: VOLATILE

- description: Repeated start detected
name: rsr

typedefs:
i2c_t:
description: System settings for the device
type_size: 64
total_size: 64
elements:
- description: Specific modes for I2C
name: mode
Expand Down Expand Up @@ -70,44 +73,50 @@ typedefs:
invalid: 125
max: 124
min: 8
- access: read-only
- write_permission: null
description: Current state of i2c frame - 0:initialized - 1:reading data - 2-write address received - 3-1st reg byte received - 4-writing data - 5-NACK - 6-stopped
name: state
flag: VOLATILE
type: uint16_t
- access: read-only
- write_permission: null
description: Current index of reg pointer
name: reg_index
type: uint16_t
- access: read-only
- write_permission: null
description: Start index of reg pointer
name: start_reg_index
type: uint16_t
- access: read-only
- write_permission: null
description: Last read frame byte count - only in reg if_type 0
name: r_count
type: uint8_t
- access: read-only
- write_permission: null
description: Last write frame byte count - only in reg if_type 0
name: w_count
type: uint8_t
- access: read-only
- write_permission: null
description: Ticks for read byte - only in reg if_type 0
name: r_ticks
type: uint32_t
- access: read-only
- write_permission: null
description: Ticks for write byte
name: w_ticks
type: uint32_t
- access: read-only
- write_permission: null
description: Holder when the start occurred
name: s_ticks
type: uint32_t
- access: read-only
- write_permission: null
description: Ticks for full read frame after the address is acked
name: f_r_ticks
type: uint32_t
- access: read-only
- write_permission: null
description: Ticks for full write frame
name: f_w_ticks
type: uint32_t

overrides:
i2c.dut_sda.level:
flag: VOLATILE
i2c.dut_scl.level:
flag: VOLATILE
41 changes: 9 additions & 32 deletions examples/philip/map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,6 @@ metadata:
- interface
- peripheral

enums:
enu1:
elements:
- o1
- o2
enu2:
type: uint8_t
bitwise: true
elements:
- name: t1
- t2
- t5
- name: t3
value: 99
description: TEST


bitfields:

basic_mode_t:
Expand All @@ -39,10 +22,9 @@ typedefs:

timestamp_t:
description: Time and date
access: read-only
write_permission: null
total_size: 8
elements:
- name: test
type: enu1
- description: The seconds in decimal
name: second
type: uint8_t
Expand All @@ -67,7 +49,7 @@ typedefs:

trace_t:
description: Saved timestamps and events
access: read-only
write_permission: null
elements:
- description: Index of the current trace
name: index
Expand All @@ -93,10 +75,12 @@ typedefs:

map_t:
description: The memory map
write_permission:
- interface
elements:
- permission:
- interface
- peripheral
- write_permission:
- interface
- peripheral
array_size: 256
description: Writable registers for user testing - Starts at 0 and increases 1 each register by default
name: user_reg
Expand Down Expand Up @@ -134,13 +118,6 @@ typedefs:
- description: Saved timestamps and events
name: trace
type: trace_t
- type: enu1
name: enu1
- type: enu2
name: enu2
array_size: 2
type_name: map_t
type_size: 2048
access: read-write
permission: interface

Expand All @@ -162,7 +139,7 @@ overrides:


generated_maps:
map_t:
philip_map:
type: map_t


Expand Down
6 changes: 5 additions & 1 deletion examples/philip/pwm.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
typedefs:
pwm_t:
description: Controls and calculates PWM values
type_size: 32
total_size: 32
elements:
- description: basic mode for pwm settings
name: mode
Expand All @@ -24,3 +24,7 @@ typedefs:
description: Settable low time in sys clock ticks
name: l_ticks
type: uint32_t

overrides:
pwm.dut_pwm.level:
flag: VOLATILE
10 changes: 5 additions & 5 deletions examples/philip/rtc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ typedefs:
- description: basic mode for rtc settings
name: mode
type: basic_mode_t
- access: read-only
- write_permission: null
description: Seconds of rtc
flag: VOLATILE
max: 59
min: 0
name: second
type: uint8_t
- access: read-only
- write_permission: null
description: Minutes of rtc
flag: VOLATILE
max: 59
min: 0
name: minute
type: uint8_t
- access: read-only
- write_permission: null
description: Hours of rtc
flag: VOLATILE
max: 23
min: 0
name: hour
type: uint8_t
- access: read-only
- write_permission: null
description: Days of rtc
flag: VOLATILE
name: day
Expand All @@ -49,4 +49,4 @@ typedefs:
- description: Days to set of rtc
name: set_day
type: uint16_t
type_size: 16
total_size: 16
25 changes: 14 additions & 11 deletions examples/philip/spi.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
bitfields:
spi_status_t:
access: read-only
write_permission: null
description: SPI status
elements:
- description: Busy flag
Expand Down Expand Up @@ -43,7 +43,6 @@ bitfields:
typedefs:
spi_t:
description: Controls and provides information for the spi
type_size: 32
elements:
- description: Specific spi modes
name: mode
Expand All @@ -59,39 +58,43 @@ typedefs:
type: basic_gpio_t
- name: dut_nss
type: basic_gpio_t
- access: read-only
- write_permission: null
description: Current state of the spi bus - 0:initialized - 1:NSS pin just lowered - 2:writing to reg - 3:reading reg - 4:transferring data - 5:NSS up and finished
name: state
type: uint16_t
- access: read-only
- write_permission: null
description: current index of reg pointer
name: reg_index
type: uint16_t
- access: read-only
- write_permission: null
description: start index of reg pointer
name: start_reg_index
type: uint16_t
- access: read-only
- write_permission: null
description: Last read frame byte count
name: r_count
type: uint8_t
- access: read-only
- write_permission: null
description: Last write frame byte count
name: w_count
type: uint8_t
- access: read-only
- write_permission: null
description: 'The amount of bytes in the last transfer '
name: transfer_count
type: uint8_t
- access: read-only
- write_permission: null
description: Ticks per frame
name: frame_ticks
type: uint32_t
- access: read-only
- write_permission: null
description: Ticks per byte
name: byte_ticks
type: uint32_t
- access: read-only
- write_permission: null
description: Holder for previous byte ticks
name: prev_ticks
type: uint32_t
- name: sm_buf
description: Buffer for captured timestamps for speed measurement
type: uint32_t
array_size: 64
Loading

0 comments on commit 9d98618

Please sign in to comment.