From 105ba6d84a19ce8474da05eeb996ba901e6a74d1 Mon Sep 17 00:00:00 2001 From: Nguyen Hoan Hoang Date: Sat, 20 Jun 2020 17:21:05 -0400 Subject: [PATCH] SAM4E supports --- ARM/Microchip/SAM4E/SAM4E16E/EHAL/.cproject | 252 ++++++ ARM/Microchip/SAM4E/SAM4E16E/EHAL/.gitignore | 2 + ARM/Microchip/SAM4E/SAM4E16E/EHAL/.project | 844 ++++++++++++++++++ .../SAM4E/SAM4E16E/exemples/Blinky/.cproject | 261 ++++++ .../SAM4E/SAM4E16E/exemples/Blinky/.gitignore | 4 + .../SAM4E/SAM4E16E/exemples/Blinky/.project | 33 + .../SAM4E16E/exemples/Blinky/src/board.h | 73 ++ ARM/Microchip/SAM4E/SAM4E16E/src/sam4e16.ld | 21 + ARM/Microchip/SAM4E/include/iopinctrl.h | 0 ARM/Microchip/SAM4E/src/iopincfg_sam4e.c | 465 ++++++++++ 10 files changed, 1955 insertions(+) create mode 100644 ARM/Microchip/SAM4E/SAM4E16E/EHAL/.cproject create mode 100644 ARM/Microchip/SAM4E/SAM4E16E/EHAL/.gitignore create mode 100644 ARM/Microchip/SAM4E/SAM4E16E/EHAL/.project create mode 100644 ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/.cproject create mode 100755 ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/.gitignore create mode 100644 ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/.project create mode 100755 ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/src/board.h create mode 100755 ARM/Microchip/SAM4E/SAM4E16E/src/sam4e16.ld mode change 100644 => 100755 ARM/Microchip/SAM4E/include/iopinctrl.h create mode 100755 ARM/Microchip/SAM4E/src/iopincfg_sam4e.c diff --git a/ARM/Microchip/SAM4E/SAM4E16E/EHAL/.cproject b/ARM/Microchip/SAM4E/SAM4E16E/EHAL/.cproject new file mode 100644 index 00000000..bacbf3b9 --- /dev/null +++ b/ARM/Microchip/SAM4E/SAM4E16E/EHAL/.cproject @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ARM/Microchip/SAM4E/SAM4E16E/EHAL/.gitignore b/ARM/Microchip/SAM4E/SAM4E16E/EHAL/.gitignore new file mode 100644 index 00000000..ac01e665 --- /dev/null +++ b/ARM/Microchip/SAM4E/SAM4E16E/EHAL/.gitignore @@ -0,0 +1,2 @@ +/Debug/ +/Release/ diff --git a/ARM/Microchip/SAM4E/SAM4E16E/EHAL/.project b/ARM/Microchip/SAM4E/SAM4E16E/EHAL/.project new file mode 100644 index 00000000..e532d24f --- /dev/null +++ b/ARM/Microchip/SAM4E/SAM4E16E/EHAL/.project @@ -0,0 +1,844 @@ + + + EHAL + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + include/base64.h + 1 + PARENT-5-PROJECT_LOC/include/base64.h + + + include/blueio_types.h + 1 + PARENT-5-PROJECT_LOC/include/blueio_types.h + + + include/cfifo.h + 1 + PARENT-5-PROJECT_LOC/include/cfifo.h + + + include/converters + 2 + virtual:/virtual + + + include/convutil.h + 1 + PARENT-5-PROJECT_LOC/include/convutil.h + + + include/coredev + 2 + virtual:/virtual + + + include/crc.h + 1 + PARENT-5-PROJECT_LOC/include/crc.h + + + include/device bridge.h + 1 + PARENT-5-PROJECT_LOC/include/device%20bridge.h + + + include/device.h + 1 + PARENT-5-PROJECT_LOC/include/device.h + + + include/device_intrf.h + 1 + PARENT-5-PROJECT_LOC/include/device_intrf.h + + + include/diskio.h + 1 + PARENT-5-PROJECT_LOC/include/diskio.h + + + include/diskio_flash.h + 1 + PARENT-5-PROJECT_LOC/include/diskio_flash.h + + + include/fatfs.h + 1 + PARENT-5-PROJECT_LOC/include/fatfs.h + + + include/imu + 2 + virtual:/virtual + + + include/intelhex.h + 1 + PARENT-5-PROJECT_LOC/include/intelhex.h + + + include/isha1.h + 1 + PARENT-5-PROJECT_LOC/include/isha1.h + + + include/isha256.h + 1 + PARENT-5-PROJECT_LOC/include/isha256.h + + + include/istddef.h + 1 + PARENT-5-PROJECT_LOC/include/istddef.h + + + include/md5.h + 1 + PARENT-5-PROJECT_LOC/include/md5.h + + + include/miscdev + 2 + virtual:/virtual + + + include/prbs.h + 1 + PARENT-5-PROJECT_LOC/include/prbs.h + + + include/pulse_train.h + 1 + PARENT-5-PROJECT_LOC/include/pulse_train.h + + + include/pwm.h + 1 + PARENT-5-PROJECT_LOC/include/pwm.h + + + include/pwrmgnt + 2 + virtual:/virtual + + + include/sdcard.h + 1 + PARENT-5-PROJECT_LOC/include/sdcard.h + + + include/seep.h + 1 + PARENT-5-PROJECT_LOC/include/seep.h + + + include/sensors + 2 + virtual:/virtual + + + include/slip_intrf.h + 1 + PARENT-5-PROJECT_LOC/include/slip_intrf.h + + + include/stddev.h + 1 + PARENT-5-PROJECT_LOC/include/stddev.h + + + include/sys + 2 + virtual:/virtual + + + include/sysstatus.h + 1 + PARENT-5-PROJECT_LOC/include/sysstatus.h + + + include/sysstatusdef.h + 1 + PARENT-5-PROJECT_LOC/include/sysstatusdef.h + + + include/usb + 2 + virtual:/virtual + + + include/utf8.h + 1 + PARENT-5-PROJECT_LOC/include/utf8.h + + + include/utf8cvt.h + 1 + PARENT-5-PROJECT_LOC/include/utf8cvt.h + + + src/CppRuntimeOverload.cpp + 1 + PARENT-5-PROJECT_LOC/src/CppRuntimeOverload.cpp + + + src/base64.c + 1 + PARENT-5-PROJECT_LOC/src/base64.c + + + src/cfifo.c + 1 + PARENT-5-PROJECT_LOC/src/cfifo.c + + + src/converters + 2 + virtual:/virtual + + + src/coredev + 2 + virtual:/virtual + + + src/crc.c + 1 + PARENT-5-PROJECT_LOC/src/crc.c + + + src/device.cpp + 1 + PARENT-5-PROJECT_LOC/src/device.cpp + + + src/device_intrf.cpp + 1 + PARENT-5-PROJECT_LOC/src/device_intrf.cpp + + + src/diskio_flash.cpp + 1 + PARENT-5-PROJECT_LOC/src/diskio_flash.cpp + + + src/diskio_impl.cpp + 1 + PARENT-5-PROJECT_LOC/src/diskio_impl.cpp + + + src/fatfs.cpp + 1 + PARENT-5-PROJECT_LOC/src/fatfs.cpp + + + src/imu + 2 + virtual:/virtual + + + src/intelhex.c + 1 + PARENT-5-PROJECT_LOC/src/intelhex.c + + + src/isha1.c + 1 + PARENT-5-PROJECT_LOC/src/isha1.c + + + src/isha256.c + 1 + PARENT-5-PROJECT_LOC/src/isha256.c + + + src/md5.c + 1 + PARENT-5-PROJECT_LOC/src/md5.c + + + src/miscdev + 2 + virtual:/virtual + + + src/prbs.c + 1 + PARENT-5-PROJECT_LOC/src/prbs.c + + + src/pulse_train.c + 1 + PARENT-5-PROJECT_LOC/src/pulse_train.c + + + src/pwrmgnt + 2 + virtual:/virtual + + + src/sbuffer.c + 1 + PARENT-5-PROJECT_LOC/src/sbuffer.c + + + src/sdcard_impl.cpp + 1 + PARENT-5-PROJECT_LOC/src/sdcard_impl.cpp + + + src/seep_impl.cpp + 1 + PARENT-5-PROJECT_LOC/src/seep_impl.cpp + + + src/sensors + 2 + virtual:/virtual + + + src/slip_intrf.cpp + 1 + PARENT-5-PROJECT_LOC/src/slip_intrf.cpp + + + src/stddev.c + 1 + PARENT-5-PROJECT_LOC/src/stddev.c + + + src/sysstatus.c + 1 + PARENT-5-PROJECT_LOC/src/sysstatus.c + + + src/uart_retarget.c + 1 + PARENT-5-PROJECT_LOC/src/uart_retarget.c + + + src/utf8.c + 1 + PARENT-5-PROJECT_LOC/src/utf8.c + + + src/utf8cvt.cpp + 1 + PARENT-5-PROJECT_LOC/src/utf8cvt.cpp + + + include/converters/adc_device.h + 1 + PARENT-5-PROJECT_LOC/include/converters/adc_device.h + + + include/converters/adc_ltc2495.h + 1 + PARENT-5-PROJECT_LOC/include/converters/adc_ltc2495.h + + + include/converters/analog_comp.h + 1 + PARENT-5-PROJECT_LOC/include/converters/analog_comp.h + + + include/converters/dac_device.h + 1 + PARENT-5-PROJECT_LOC/include/converters/dac_device.h + + + include/coredev/i2c.h + 1 + PARENT-5-PROJECT_LOC/include/coredev/i2c.h + + + include/coredev/iopincfg.h + 1 + PARENT-5-PROJECT_LOC/include/coredev/iopincfg.h + + + include/coredev/pdm.h + 1 + PARENT-5-PROJECT_LOC/include/coredev/pdm.h + + + include/coredev/spi.h + 1 + PARENT-5-PROJECT_LOC/include/coredev/spi.h + + + include/coredev/timer.h + 1 + PARENT-5-PROJECT_LOC/include/coredev/timer.h + + + include/coredev/uart.h + 1 + PARENT-5-PROJECT_LOC/include/coredev/uart.h + + + include/imu/icm20948_img_dmp3a.h + 1 + PARENT-5-PROJECT_LOC/include/imu/icm20948_img_dmp3a.h + + + include/imu/imu.h + 1 + PARENT-5-PROJECT_LOC/include/imu/imu.h + + + include/imu/imu_icm20948.h + 1 + PARENT-5-PROJECT_LOC/include/imu/imu_icm20948.h + + + include/imu/imu_invn_icm20948.h + 1 + PARENT-5-PROJECT_LOC/include/imu/imu_invn_icm20948.h + + + include/imu/imu_mpu9250.h + 1 + PARENT-5-PROJECT_LOC/include/imu/imu_mpu9250.h + + + include/imu/mpu9250_dmpkey.h + 1 + PARENT-5-PROJECT_LOC/include/imu/mpu9250_dmpkey.h + + + include/imu/mpu9250_dmpmap.h + 1 + PARENT-5-PROJECT_LOC/include/imu/mpu9250_dmpmap.h + + + include/miscdev/buzzer.h + 1 + PARENT-5-PROJECT_LOC/include/miscdev/buzzer.h + + + include/miscdev/led.h + 1 + PARENT-5-PROJECT_LOC/include/miscdev/led.h + + + include/miscdev/led_apa102.h + 1 + PARENT-5-PROJECT_LOC/include/miscdev/led_apa102.h + + + include/miscdev/led_ncp5623b.h + 1 + PARENT-5-PROJECT_LOC/include/miscdev/led_ncp5623b.h + + + include/miscdev/ledmx.h + 1 + PARENT-5-PROJECT_LOC/include/miscdev/ledmx.h + + + include/miscdev/ledmxfont.h + 1 + PARENT-5-PROJECT_LOC/include/miscdev/ledmxfont.h + + + include/miscdev/modem.h + 1 + PARENT-5-PROJECT_LOC/include/miscdev/modem.h + + + include/miscdev/tca6424a.h + 1 + PARENT-5-PROJECT_LOC/include/miscdev/tca6424a.h + + + include/pwrmgnt/fg_lc709203f.h + 1 + PARENT-5-PROJECT_LOC/include/pwrmgnt/fg_lc709203f.h + + + include/pwrmgnt/pm_as3701.h + 1 + PARENT-5-PROJECT_LOC/include/pwrmgnt/pm_as3701.h + + + include/pwrmgnt/pwrmgnt.h + 1 + PARENT-5-PROJECT_LOC/include/pwrmgnt/pwrmgnt.h + + + include/sensors/accel_adxl362.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/accel_adxl362.h + + + include/sensors/accel_h3lis331dl.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/accel_h3lis331dl.h + + + include/sensors/accel_lis2dh12.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/accel_lis2dh12.h + + + include/sensors/accel_sensor.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/accel_sensor.h + + + include/sensors/ag_bmi160.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/ag_bmi160.h + + + include/sensors/agm_icm20948.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/agm_icm20948.h + + + include/sensors/agm_invn_icm20948.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/agm_invn_icm20948.h + + + include/sensors/agm_lsm9ds1.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/agm_lsm9ds1.h + + + include/sensors/agm_mpu9250.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/agm_mpu9250.h + + + include/sensors/am_fxos8700cq.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/am_fxos8700cq.h + + + include/sensors/am_lsm303agr.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/am_lsm303agr.h + + + include/sensors/am_lsm303c.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/am_lsm303c.h + + + include/sensors/bsec_datatypes.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/bsec_datatypes.h + + + include/sensors/bsec_interface.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/bsec_interface.h + + + include/sensors/gas_sensor.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/gas_sensor.h + + + include/sensors/gyro_l3gd20h.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/gyro_l3gd20h.h + + + include/sensors/gyro_sensor.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/gyro_sensor.h + + + include/sensors/humi_sensor.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/humi_sensor.h + + + include/sensors/mag_ak09916.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/mag_ak09916.h + + + include/sensors/mag_bmm150.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/mag_bmm150.h + + + include/sensors/mag_sensor.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/mag_sensor.h + + + include/sensors/press_sensor.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/press_sensor.h + + + include/sensors/sensor.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/sensor.h + + + include/sensors/temp_sensor.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/temp_sensor.h + + + include/sensors/tph_bme280.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/tph_bme280.h + + + include/sensors/tph_ms8607.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/tph_ms8607.h + + + include/sensors/tph_sensor.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/tph_sensor.h + + + include/sensors/tphg_bme680.h + 1 + PARENT-5-PROJECT_LOC/include/sensors/tphg_bme680.h + + + include/sys/dirent.h + 1 + PARENT-5-PROJECT_LOC/include/sys/dirent.h + + + include/usb/usb_cdcdef.h + 1 + PARENT-5-PROJECT_LOC/include/usb/usb_cdcdef.h + + + include/usb/usb_def.h + 1 + PARENT-5-PROJECT_LOC/include/usb/usb_def.h + + + include/usb/usb_hiddef.h + 1 + PARENT-5-PROJECT_LOC/include/usb/usb_hiddef.h + + + include/usb/usb_hidhost.h + 1 + PARENT-5-PROJECT_LOC/include/usb/usb_hidhost.h + + + include/usb/usb_mscdef.h + 1 + PARENT-5-PROJECT_LOC/include/usb/usb_mscdef.h + + + src/converters/adc_ltc2495.cpp + 1 + PARENT-5-PROJECT_LOC/src/converters/adc_ltc2495.cpp + + + src/coredev/i2c.cpp + 1 + PARENT-5-PROJECT_LOC/src/coredev/i2c.cpp + + + src/coredev/iopincfg_sam4e.c + 1 + PARENT-2-PROJECT_LOC/src/iopincfg_sam4e.c + + + src/coredev/spi.cpp + 1 + PARENT-5-PROJECT_LOC/src/coredev/spi.cpp + + + src/coredev/timer.cpp + 1 + PARENT-5-PROJECT_LOC/src/coredev/timer.cpp + + + src/coredev/uart.c + 1 + PARENT-5-PROJECT_LOC/src/coredev/uart.c + + + src/imu/imu.cpp + 1 + PARENT-5-PROJECT_LOC/src/imu/imu.cpp + + + src/imu/imu_icm20948.cpp + 1 + PARENT-5-PROJECT_LOC/src/imu/imu_icm20948.cpp + + + src/imu/imu_invn_icm20948.cpp + 1 + PARENT-5-PROJECT_LOC/src/imu/imu_invn_icm20948.cpp + + + src/imu/imu_mpu9250.cpp + 1 + PARENT-5-PROJECT_LOC/src/imu/imu_mpu9250.cpp + + + src/miscdev/buzzer.cpp + 1 + PARENT-5-PROJECT_LOC/src/miscdev/buzzer.cpp + + + src/miscdev/led_apa102.cpp + 1 + PARENT-5-PROJECT_LOC/src/miscdev/led_apa102.cpp + + + src/miscdev/led_gpio.cpp + 1 + PARENT-5-PROJECT_LOC/src/miscdev/led_gpio.cpp + + + src/miscdev/led_ncp5623b.cpp + 1 + PARENT-5-PROJECT_LOC/src/miscdev/led_ncp5623b.cpp + + + src/miscdev/led_pwm.cpp + 1 + PARENT-5-PROJECT_LOC/src/miscdev/led_pwm.cpp + + + src/miscdev/ledmx.c + 1 + PARENT-5-PROJECT_LOC/src/miscdev/ledmx.c + + + src/miscdev/ledmxfont.c + 1 + PARENT-5-PROJECT_LOC/src/miscdev/ledmxfont.c + + + src/miscdev/modem.cpp + 1 + PARENT-5-PROJECT_LOC/src/miscdev/modem.cpp + + + src/pwrmgnt/fg_lc709203f.cpp + 1 + PARENT-5-PROJECT_LOC/src/pwrmgnt/fg_lc709203f.cpp + + + src/pwrmgnt/pm_as3701.cpp + 1 + PARENT-5-PROJECT_LOC/src/pwrmgnt/pm_as3701.cpp + + + src/sensors/accel_adxl362.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/accel_adxl362.cpp + + + src/sensors/accel_lis2dh12.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/accel_lis2dh12.cpp + + + src/sensors/accel_sensor.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/accel_sensor.cpp + + + src/sensors/ag_bmi160.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/ag_bmi160.cpp + + + src/sensors/agm_icm20948.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/agm_icm20948.cpp + + + src/sensors/agm_invn_icm20948.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/agm_invn_icm20948.cpp + + + src/sensors/agm_mpu9250.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/agm_mpu9250.cpp + + + src/sensors/am_fxos8700cq.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/am_fxos8700cq.cpp + + + src/sensors/gyro_l3gd20h.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/gyro_l3gd20h.cpp + + + src/sensors/gyro_sensor.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/gyro_sensor.cpp + + + src/sensors/mag_ak09916.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/mag_ak09916.cpp + + + src/sensors/mag_bmm150.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/mag_bmm150.cpp + + + src/sensors/mag_sensor.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/mag_sensor.cpp + + + src/sensors/tph_bme280.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/tph_bme280.cpp + + + src/sensors/tph_ms8607.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/tph_ms8607.cpp + + + src/sensors/tphg_bme680.cpp + 1 + PARENT-5-PROJECT_LOC/src/sensors/tphg_bme680.cpp + + + diff --git a/ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/.cproject b/ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/.cproject new file mode 100644 index 00000000..be24c252 --- /dev/null +++ b/ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/.cproject @@ -0,0 +1,261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/.gitignore b/ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/.gitignore new file mode 100755 index 00000000..65d351dc --- /dev/null +++ b/ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/.gitignore @@ -0,0 +1,4 @@ +/Debug +/Release +/Debug S110 +/RTX_Debug/ diff --git a/ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/.project b/ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/.project new file mode 100644 index 00000000..2e5b8575 --- /dev/null +++ b/ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/.project @@ -0,0 +1,33 @@ + + + Blinky + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + src/blinky.c + 1 + PARENT-6-PROJECT_LOC/exemples/miscdev/blinky.c + + + diff --git a/ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/src/board.h b/ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/src/board.h new file mode 100755 index 00000000..efe7b7dd --- /dev/null +++ b/ARM/Microchip/SAM4E/SAM4E16E/exemples/Blinky/src/board.h @@ -0,0 +1,73 @@ +/**------------------------------------------------------------------------- +@example board.h + +@brief Board specific definitions + +This file contains all I/O definitions for a specific board for the +application firmware. This files should be located in each project and +modified to suit the need for the application use case. + +@author Hoang Nguyen Hoan +@date Aug. 31, 2014 + +@license + +Copyright (c) 2014, I-SYST inc., all rights reserved + +Permission to use, copy, modify, and distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright +notice and this permission notice appear in all copies, and none of the +names : I-SYST or its contributors may be used to endorse or +promote products derived from this software without specific prior written +permission. + +For info or contributing contact : hnhoan at i-syst dot com + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. + +----------------------------------------------------------------------------*/ + +#ifndef __BOARD_H__ +#define __BOARD_H__ + +// *** SAM4E + +// LED1 +#define LED1_PORT 3 +#define LED1_PIN 10 +#define LED1_PINOP 0 + +// LED2 +#define LED2_PORT 3 +#define LED2_PIN 15 +#define LED2_PINOP 0 + +// LED3 +#define LED3_PORT 2 +#define LED3_PIN 20 +#define LED3_PINOP 0 + +#define LED_PINS_MAP { \ + {LED1_PORT, LED1_PIN, LED1_PINOP, IOPINDIR_OUTPUT, IOPINRES_NONE, IOPINTYPE_NORMAL}, \ + {LED3_PORT, LED3_PIN, LED3_PINOP, IOPINDIR_OUTPUT, IOPINRES_NONE, IOPINTYPE_NORMAL}, \ + {LED2_PORT, LED2_PIN, LED2_PINOP, IOPINDIR_OUTPUT, IOPINRES_NONE, IOPINTYPE_NORMAL}, \ +} + +#define PULSE_TRAIN_PINS_MAP { \ + {0, 4, 0}, {0, 6, 0}, {0, 7, 0}, \ + {1, 0, 0}, {1, 1, 0}, {1, 2, 0}, {1, 3, 0}, {1, 4, 0}, {1, 5, 0}, {1, 6, 0}, {1, 7, 0}, \ + {2, 0, 0}, {2, 1, 0}, {2, 2, 0}, {2, 3, 0}, {2, 4, 0}, {2, 5, 0}, {2, 6, 0}, {2, 7, 0}, \ + {3, 0, 0}, {3, 1, 0}, {3, 2, 0}, {3, 3, 0}, {3, 4, 0}, {3, 5, 0}, {3, 6, 0}, {3, 7, 0}, \ +} + +#endif // __BOARD_H__ + diff --git a/ARM/Microchip/SAM4E/SAM4E16E/src/sam4e16.ld b/ARM/Microchip/SAM4E/SAM4E16E/src/sam4e16.ld new file mode 100755 index 00000000..3b82d3df --- /dev/null +++ b/ARM/Microchip/SAM4E/SAM4E16E/src/sam4e16.ld @@ -0,0 +1,21 @@ +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) +SEARCH_DIR("../../../../src") +SEARCH_DIR("../../../../../src") +SEARCH_DIR("../../../../../../src") +SEARCH_DIR("../../../../../../../src") +SEARCH_DIR("../../../../EHAL/ARM/src") +SEARCH_DIR("../../../../../EHAL/ARM/src") +SEARCH_DIR("../../../../../../EHAL/ARM/src") +SEARCH_DIR("../../../../../../../EHAL/ARM/src") +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00400000, LENGTH = 0x00100000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00020000 +} + +INCLUDE "gcc_arm_flash.ld" + diff --git a/ARM/Microchip/SAM4E/include/iopinctrl.h b/ARM/Microchip/SAM4E/include/iopinctrl.h old mode 100644 new mode 100755 diff --git a/ARM/Microchip/SAM4E/src/iopincfg_sam4e.c b/ARM/Microchip/SAM4E/src/iopincfg_sam4e.c new file mode 100755 index 00000000..0413e12f --- /dev/null +++ b/ARM/Microchip/SAM4E/src/iopincfg_sam4e.c @@ -0,0 +1,465 @@ +/**------------------------------------------------------------------------- +@file iopincfg_sam4e.c + +@brief I/O pin configuration implementation on SAM4E series + +The SAM4 has one interrupt handler for each GPIO port. + +@author Hoang Nguyen Hoan +@date June 1, 2020 + +@license + +Copyright (c) 2020, I-SYST inc., all rights reserved + +Permission to use, copy, modify, and distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright +notice and this permission notice appear in all copies, and none of the +names : I-SYST or its contributors may be used to endorse or +promote products derived from this software without specific prior written +permission. + +For info or contributing contact : hnhoan at i-syst dot com + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. + +----------------------------------------------------------------------------*/ + +#include +#include + +#include "sam4e.h" +#include "coredev/iopincfg.h" + +#define IOPIN_MAX_PINOP (5) + +#if defined(_SAM4E_PIOE_INSTANCE_) + #define IOPIN_MAX_PORT (5) +#elif defined(_SAM4E_PIOD_INSTANCE_) + #define IOPIN_MAX_PORT (4) +#elif defined(_SAM4E_PIOC_INSTANCE_) + #define IOPIN_MAX_PORT (3) +#else + #define IOPIN_MAX_PORT (2) +#endif + +#define IOPIN_MAX_INT (IOPIN_MAX_PORT) + +#pragma pack(push, 4) +typedef struct { + IOPINSENSE Sense; + IOPINEVT_CB SensEvtCB; + uint16_t PortPinNo; +} IOPINSENS_EVTHOOK; +#pragma pack(pop) + +static IOPINSENS_EVTHOOK s_GpIOSenseEvt[IOPIN_MAX_INT + 1] = { {0, NULL}, }; + +/** + * @brief Configure individual I/O pin. + * + * @Param PortNo : Port number + * SAM4 ports are named A, B, C,... + * 0 = A, 1 = B, ... + * PinNo : Pin number + * PinOp : Pin function index from 0. MCU dependent + * for SAM4 + * 0 : GPIO mode + * 1-4 : Peripheral A-D + * + * Dir : I/O direction + * Resistor: Resistor configuration + * Type : I/O type + */ +void IOPinConfig(int PortNo, int PinNo, int PinOp, IOPINDIR Dir, IOPINRES Resistor, IOPINTYPE Type) +{ + Sam4ePio *reg = (Sam4ePio *)((uint32_t)SAM4E_PIOA + PortNo * 0x200); + + if (PortNo == -1 || PinNo == -1 || PortNo > IOPIN_MAX_PORT) + return; + + uint32_t pinmask = 1 << PinNo; + + // Enable peripheral clock + SAM4E_PMC->PMC_PCER0 |= 1 << (9 + PortNo); + + if (PinOp > 0 && PinOp <= IOPIN_MAX_PINOP) + { + // Configure as peripheral + reg->PIO_PDR |= pinmask; + + uint8_t psel = PinOp - 1; + + if (psel & 1) + { + reg->PIO_ABCDSR[0] |= pinmask; + } + else + { + reg->PIO_ABCDSR[0] &= ~pinmask; + } + + if (psel & 2) + { + reg->PIO_ABCDSR[1] |= pinmask; + } + else + { + reg->PIO_ABCDSR[1] &= ~pinmask; + } + } + else + { + // Configure as GPIO + reg->PIO_PER |= pinmask; + + if (Dir == IOPINDIR_OUTPUT) + { + reg->PIO_OER |= pinmask; + reg->PIO_OWER |= pinmask; + } + else + { + reg->PIO_ODR &= pinmask; + reg->PIO_OWDR |= pinmask; + } + } + + reg->PIO_PUDR |= pinmask; + reg->PIO_PPDDR |= pinmask; + + switch (Resistor) + { + case IOPINRES_FOLLOW: + case IOPINRES_PULLUP: + reg->PIO_PUER |= pinmask; + break; + case IOPINRES_PULLDOWN: + reg->PIO_PPDER |= pinmask; + break; + case IOPINRES_NONE: + break; + } + + if (Type == IOPINTYPE_OPENDRAIN) + { + reg->PIO_MDER |= pinmask; + } + else + { + reg->PIO_MDDR |= pinmask; + } +} + +/** + * @brief Disable I/O pin + * + * Some hardware such as low power mcu allow I/O pin to be disconnected + * in order to save power. There is no enable function. Reconfigure the + * I/O pin to re-enable it. + * + * @param PortNo : Port number + * @param PinNo : Pin Number + */ +void IOPinDisable(int PortNo, int PinNo) +{ + if (PortNo == -1 || PinNo == -1) + return; + + Sam4ePio *reg = (Sam4ePio *)((uint32_t)SAM4E_PIOA + PortNo * 0x200); + reg->PIO_PDR |= 1 << PinNo; +} + +/** + * @brief Disable I/O pin sense interrupt + * + * @param IntNo : Interrupt number to disable + */ +void IOPinDisableInterrupt(int IntNo) +{ + if (IntNo < 0 || IntNo >= IOPIN_MAX_INT) + { + return; + } + + Sam4ePio *reg = (Sam4ePio *)((uint32_t)SAM4E_PIOA + ((s_GpIOSenseEvt[IntNo].PortPinNo >> 8) & 0xFF) * 0x200); + + reg->PIO_IDR |= 1 << (s_GpIOSenseEvt[IntNo].PortPinNo & 0xFF); + + s_GpIOSenseEvt[IntNo].PortPinNo = -1; + s_GpIOSenseEvt[IntNo].Sense = IOPINSENSE_DISABLE; + s_GpIOSenseEvt[IntNo].SensEvtCB = NULL; + + switch (IntNo) + { + case 0: + NVIC_DisableIRQ(PIOA_IRQn); + NVIC_ClearPendingIRQ(PIOA_IRQn); + break; + case 1: + NVIC_DisableIRQ(PIOB_IRQn); + NVIC_ClearPendingIRQ(PIOB_IRQn); + break; + case 2: + NVIC_DisableIRQ(PIOC_IRQn); + NVIC_ClearPendingIRQ(PIOC_IRQn); + break; + case 3: + NVIC_DisableIRQ(PIOD_IRQn); + NVIC_ClearPendingIRQ(PIOD_IRQn); + break; + case 4: + NVIC_DisableIRQ(PIOE_IRQn); + NVIC_ClearPendingIRQ(PIOE_IRQn); + break; + } +} + +/** + * @brief Enable I/O pin sensing interrupt event + * + * Generate an interrupt when I/O sense a state change. + * The IntNo (interrupt number) parameter is processor dependent. Some is + * directly the hardware interrupt number other is just an index in an array + * + * STM32 : IntNo must be same as PinNo. It is directly related to hardware. + * + * @param IntNo : Interrupt number. -1 for port event interrupt + * IntPrio : Interrupt priority + * PortNo : Port number (up to 32 ports) + * PinNo : Pin number (up to 32 pins) + * Sense : Sense type of event on the I/O pin + * pEvtCB : Pointer to callback function when event occurs + */ +bool IOPinEnableInterrupt(int IntNo, int IntPrio, int PortNo, int PinNo, IOPINSENSE Sense, IOPINEVT_CB pEvtCB) +{ + if (IntNo < 0 || IntNo >= IOPIN_MAX_INT || IntNo != PortNo) + { + return false; + } + + Sam4ePio *reg = (Sam4ePio *)((uint32_t)SAM4E_PIOA + PortNo * 0x200); + + IOPinSetSense(PortNo, PinNo, Sense); + + s_GpIOSenseEvt[IntNo].Sense = Sense; + s_GpIOSenseEvt[IntNo].PortPinNo = (PortNo << 8) | PinNo; // For use when disable interrupt + s_GpIOSenseEvt[IntNo].SensEvtCB = pEvtCB; + + reg->PIO_IER = 1 << PinNo; + + switch (IntNo) + { + case 0: + NVIC_ClearPendingIRQ(PIOA_IRQn); + NVIC_SetPriority(PIOA_IRQn, IntPrio); + NVIC_EnableIRQ(PIOA_IRQn); + break; + case 1: + NVIC_ClearPendingIRQ(PIOB_IRQn); + NVIC_SetPriority(PIOB_IRQn, IntPrio); + NVIC_EnableIRQ(PIOB_IRQn); + break; + case 2: + NVIC_ClearPendingIRQ(PIOC_IRQn); + NVIC_SetPriority(PIOC_IRQn, IntPrio); + NVIC_EnableIRQ(PIOC_IRQn); + break; + case 3: + NVIC_ClearPendingIRQ(PIOD_IRQn); + NVIC_SetPriority(PIOD_IRQn, IntPrio); + NVIC_EnableIRQ(PIOD_IRQn); + break; + case 4: + NVIC_ClearPendingIRQ(PIOE_IRQn); + NVIC_SetPriority(PIOE_IRQn, IntPrio); + NVIC_EnableIRQ(PIOE_IRQn); + break; + } + + return true; +} + +int IOPinFindAvailInterrupt() +{ + for (int i = 0; i < IOPIN_MAX_INT; i++) + { + if (s_GpIOSenseEvt[i].SensEvtCB == NULL) + { + return i; + } + } + + return -1; +} + +/** + * @brief Allocate I/O pin sensing interrupt event + * + * Generate an interrupt when I/O sense a state change. This function will automatically + * allocate available interrupt number to use for the pin. + * The IntNo (interrupt number) parameter is processor dependent. Some is + * directly the hardware interrupt number other is just an index in an array + * + * + * @Param IntPrio : Interrupt priority + * @Param PortNo : Port number (up to 32 ports) + * @Param PinNo : Pin number (up to 32 pins) + * @Param Sense : Sense type of event on the I/O pin + * @Param pEvtCB : Pointer to callback function when event occurs + * + * @return Interrupt number on success + * -1 on failure. + */ +int IOPinAllocateInterrupt(int IntPrio, int PortNo, int PinNo, IOPINSENSE Sense, IOPINEVT_CB pEvtCB) +{ + int intno = IOPinFindAvailInterrupt(); + + if (intno >= 0) + { + bool res = IOPinEnableInterrupt(intno, IntPrio, PortNo, PinNo, Sense, pEvtCB); + if (res == true) + return intno; + } + + return -1; +} + +/** + * @brief Set I/O pin sensing option + * + * Some hardware allow pin sensing to wake up or active other subsystem without + * requiring enabling interrupts. This requires the I/O already configured + * + * @param PortNo : Port number (up to 32 ports) + * PinNo : Pin number (up to 32 pins) + * Sense : Sense type of event on the I/O pin + */ +void IOPinSetSense(int PortNo, int PinNo, IOPINSENSE Sense) +{ + if (PortNo < 0 || PinNo < 0 || PortNo > IOPIN_MAX_PORT || PinNo > 31) + { + return; + } + + Sam4ePio *reg = (Sam4ePio *)((uint32_t)SAM4E_PIOA + PortNo * 0x200); + uint32_t pinmask = 1 << PinNo; + + switch (Sense) + { + case IOPINSENSE_LOW_TRANSITION: + reg->PIO_FELLSR |= pinmask; + reg->PIO_ESR |= pinmask; + break; + case IOPINSENSE_HIGH_TRANSITION: + reg->PIO_REHLSR |= pinmask; + reg->PIO_ESR |= pinmask; + break; + case IOPINSENSE_TOGGLE: + reg->PIO_AIMDR |= pinmask; + break; + } +} + +/** + * @brief Set I/O pin drive strength option + * + * Some hardware allow setting pin drive strength. This requires the I/O already configured + * + * @param PortNo : Port number (up to 32 ports) + * PinNo : Pin number (up to 32 pins) + * Strength: Pin drive strength + */ +void IOPinSetStrength(int PortNo, int PinNo, IOPINSTRENGTH Strength) +{ + // Not available +} + +/** + * @brief Set I/O pin speed option + * + * Some hardware allow setting pin speed. This requires the I/O already configured + * + * @param PortNo : Port number (up to 32 ports) + * @Param PinNo : Pin number (up to 32 pins) + * @Param Speed : Pin speed + */ +void IOPinSetSpeed(int PortNo, int PinNo, IOPINSPEED Speed) +{ + // Not avail +} + +void PIOA_Handler(void) +{ + uint32_t status = SAM4E_PIOA->PIO_ISR; + + if (status) + { + if (s_GpIOSenseEvt[0].SensEvtCB) + s_GpIOSenseEvt[0].SensEvtCB(status); + } + + NVIC_ClearPendingIRQ(PIOA_IRQn); +} + +void PIOB_Handler(void) +{ + uint32_t status = SAM4E_PIOA->PIO_ISR; + + if (status) + { + if (s_GpIOSenseEvt[1].SensEvtCB) + s_GpIOSenseEvt[1].SensEvtCB(status); + } + + NVIC_ClearPendingIRQ(PIOB_IRQn); +} + +void PIOC_Handler(void) +{ + uint32_t status = SAM4E_PIOA->PIO_ISR; + + if (status) + { + if (s_GpIOSenseEvt[2].SensEvtCB) + s_GpIOSenseEvt[2].SensEvtCB(status); + } + + NVIC_ClearPendingIRQ(PIOC_IRQn); +} + +void PIOD_Handler(void) +{ + uint32_t status = SAM4E_PIOA->PIO_ISR; + + if (status) + { + if (s_GpIOSenseEvt[3].SensEvtCB) + s_GpIOSenseEvt[3].SensEvtCB(status); + } + + NVIC_ClearPendingIRQ(PIOD_IRQn); +} + +void PIOE_Handler(void) +{ + uint32_t status = SAM4E_PIOA->PIO_ISR; + + if (status) + { + if (s_GpIOSenseEvt[4].SensEvtCB) + s_GpIOSenseEvt[4].SensEvtCB(status); + } + + NVIC_ClearPendingIRQ(PIOE_IRQn); +} +