Merge remote-tracking branch 'adafruit/master' into mini_sam
This commit is contained in:
commit
95e0309263
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -75,10 +75,10 @@
|
||||
url = https://github.com/adafruit/Adafruit_CircuitPython_Crickit
|
||||
[submodule "ports/nrf/nrfx"]
|
||||
path = ports/nrf/nrfx
|
||||
url = https://github.com/NordicSemiconductor/nrfx.git
|
||||
url = https://github.com/adafruit/nrfx.git
|
||||
[submodule "lib/tinyusb"]
|
||||
path = lib/tinyusb
|
||||
url = https://github.com/hathach/tinyusb.git
|
||||
url = https://github.com/tannewt/tinyusb.git
|
||||
branch = develop
|
||||
[submodule "tools/huffman"]
|
||||
path = tools/huffman
|
||||
|
99
.travis.yml
99
.travis.yml
@ -1,44 +1,31 @@
|
||||
sudo: required
|
||||
dist: trusty
|
||||
dist: xenial
|
||||
language: c
|
||||
compiler:
|
||||
- gcc
|
||||
git:
|
||||
depth: 1
|
||||
|
||||
# Put a representative board from each port or sub-port near the top
|
||||
# to determine more quickly whether that port is going to build or not.
|
||||
# Each item under 'env' is a separate Travis job to execute.
|
||||
# They run in separate environments, so each one must take the time
|
||||
# to clone the repository and submodules; to download and install SDKs,
|
||||
# pip packages, and so forth. By gathering activities together in optimal
|
||||
# ways, the "run time" and "total time" of the travis jobs can be minimized.
|
||||
#
|
||||
# Since at the time of writing Travis generally starts 5 or 6 jobs, the
|
||||
# builds have been organized into 5 groups of *approximately* equal durations.
|
||||
# Additionally, the jobs that need extra SDKs are also organized together.
|
||||
#
|
||||
# When adding new boards, take a look on the travis CI page
|
||||
# https://travis-ci.org/adafruit/circuitpython to which build that installs
|
||||
# that SDK is shortest and add it there. In the case of major re-organizations,
|
||||
# just try to make the builds "about equal in run time"
|
||||
env:
|
||||
- TRAVIS_TEST=unix
|
||||
- TRAVIS_TEST=docs
|
||||
- TRAVIS_TEST=translations
|
||||
- TRAVIS_BOARD=feather_huzzah
|
||||
- TRAVIS_BOARD=circuitplayground_express
|
||||
- TRAVIS_BOARD=pca10056
|
||||
# The rest of the boards, in alphabetical order.
|
||||
- TRAVIS_BOARD=trinket_m0
|
||||
- TRAVIS_BOARD=feather_m4_express
|
||||
- TRAVIS_BOARD=grandcentral_m4_express
|
||||
- TRAVIS_BOARD=arduino_zero
|
||||
- TRAVIS_BOARD=circuitplayground_express_crickit
|
||||
- TRAVIS_BOARD=feather_m0_adalogger
|
||||
- TRAVIS_BOARD=feather_m0_basic
|
||||
- TRAVIS_BOARD=feather_m0_express
|
||||
- TRAVIS_BOARD=feather_m0_express_crickit
|
||||
- TRAVIS_BOARD=feather_m0_rfm69
|
||||
- TRAVIS_BOARD=feather_m0_rfm9x
|
||||
- TRAVIS_BOARD=feather_nrf52832
|
||||
- TRAVIS_BOARD=feather_nrf52840_express
|
||||
- TRAVIS_BOARD=feather_radiofruit_zigbee
|
||||
- TRAVIS_BOARD=gemma_m0
|
||||
- TRAVIS_BOARD=hallowing_m0_express
|
||||
- TRAVIS_BOARD=itsybitsy_m0_express
|
||||
- TRAVIS_BOARD=itsybitsy_m4_express
|
||||
- TRAVIS_BOARD=metro_m0_express
|
||||
- TRAVIS_BOARD=metro_m4_express
|
||||
- TRAVIS_BOARD=pca10059
|
||||
- TRAVIS_BOARD=pirkey_m0
|
||||
- TRAVIS_BOARD=trellis_m4_express
|
||||
- TRAVIS_TESTS="unix docs translations" TRAVIS_BOARDS="feather_huzzah circuitplayground_express pca10056 pca10059 feather_nrf52832 feather_nrf52840_express makerdiary_nrf52840_mdk" TRAVIS_SDK=arm:nrf:esp8266
|
||||
- TRAVIS_BOARDS="metro_m0_express metro_m4_express pirkey_m0 trellis_m4_express trinket_m0" TRAVIS_SDK=arm
|
||||
- TRAVIS_BOARDS="feather_radiofruit_zigbee gemma_m0 hallowing_m0_express itsybitsy_m0_express itsybitsy_m4_express meowmeow" TRAVIS_SDK=arm
|
||||
- TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300" TRAVIS_SDK=arm
|
||||
- TRAVIS_BOARDS="circuitplayground_express_crickit feather_m0_adalogger feather_m0_basic feather_m0_express catwan_usbstick" TRAVIS_SDK=arm
|
||||
|
||||
addons:
|
||||
artifacts:
|
||||
@ -57,21 +44,33 @@ notifications:
|
||||
on_error: always
|
||||
|
||||
before_script:
|
||||
# Expand the git tree back to 4.0.0-alpha.1 and then fetch the latest tag.
|
||||
- LAST_TAG=`git ls-remote --quiet --tags --sort=version:refname | egrep -o "refs/tags/[0-9]+.*\$" | tail -n 1`
|
||||
- git fetch --shallow-exclude=4.0.0-alpha.1
|
||||
- git fetch --depth 1 origin $LAST_TAG:$LAST_TAG
|
||||
- git describe --dirty --always --tags
|
||||
- function var_search () { case "$1" in *$2*) true;; *) false;; esac; }
|
||||
- sudo dpkg --add-architecture i386
|
||||
|
||||
- ([[ -z "$TRAVIS_BOARD" || $TRAVIS_BOARD = "feather_huzzah" ]] || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~trusty1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb))
|
||||
- (! var_search "${TRAVIS_SDK-}" arm || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~xenial1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb))
|
||||
|
||||
# For nrf builds
|
||||
- ([[ $TRAVIS_BOARD != "feather_nrf52832" && $TRAVIS_BOARD != "feather_nrf52840_express" && $TRAVIS_BOARD != "pca10056" && $TRAVIS_BOARD != "pca10059" ]] || sudo ports/nrf/drivers/bluetooth/download_ble_stack.sh)
|
||||
- (! var_search "${TRAVIS_SDK-}" nrf || sudo ports/nrf/bluetooth/download_ble_stack.sh)
|
||||
|
||||
# For huzzah builds
|
||||
- if [[ $TRAVIS_BOARD = "feather_huzzah" ]]; then wget https://github.com/jepler/esp-open-sdk/releases/download/2018-06-10/xtensa-lx106-elf-standalone.tar.gz && tar xavf xtensa-lx106-elf-standalone.tar.gz; PATH=$(readlink -f xtensa-lx106-elf/bin):$PATH; fi
|
||||
- (! var_search "${TRAVIS_SDK-}" esp8266 || (wget https://github.com/jepler/esp-open-sdk/releases/download/2018-06-10/xtensa-lx106-elf-standalone.tar.gz && tar -C .. -xavf xtensa-lx106-elf-standalone.tar.gz))
|
||||
- if var_search "${TRAVIS_SDK-}" esp8266 ; then PATH=$(readlink -f ../xtensa-lx106-elf/bin):$PATH; fi
|
||||
|
||||
# For coverage testing (upgrade is used to get latest urllib3 version)
|
||||
- ([[ -z "$TRAVIS_TEST" ]] || sudo apt-get install -y python3-pip)
|
||||
- ([[ -z "$TRAVIS_TEST" ]] || sudo pip install --upgrade cpp-coveralls)
|
||||
- ([[ $TRAVIS_TEST != "docs" ]] || sudo pip install 'Sphinx<1.8.0' sphinx-rtd-theme recommonmark)
|
||||
- ([[ $TRAVIS_TEST != "translations" ]] || sudo pip3 install polib)
|
||||
- ([[ -z "$TRAVIS_TESTS" ]] || sudo apt-get install -y python3-pip)
|
||||
- ([[ -z "$TRAVIS_TESTS" ]] || sudo pip install --upgrade cpp-coveralls)
|
||||
- (! var_search "${TRAVIS_TESTS-}" docs || sudo pip install 'Sphinx<1.8.0' sphinx-rtd-theme recommonmark)
|
||||
- (! var_search "${TRAVIS_TESTS-}" translations || sudo pip3 install polib)
|
||||
|
||||
# report some good version numbers to the build
|
||||
- gcc --version
|
||||
- ([[ -z "$TRAVIS_BOARD" || $TRAVIS_BOARD = "feather_huzzah" ]] || arm-none-eabi-gcc --version)
|
||||
- (! var_search "${TRAVIS_SDK-}" arm || arm-none-eabi-gcc --version)
|
||||
- (! var_search "${TRAVIS_SDK-}" esp8266 || xtensa-lx106-elf-gcc --version)
|
||||
- python3 --version
|
||||
|
||||
script:
|
||||
@ -81,13 +80,11 @@ script:
|
||||
- echo -en 'travis_fold:end:mpy-cross\\r'
|
||||
|
||||
- echo 'Building Adafruit binaries' && echo -en 'travis_fold:start:adafruit-bins\\r'
|
||||
- ([[ -z "$TRAVIS_BOARD" ]] || tools/build_adafruit_bins.sh)
|
||||
- (for board in $TRAVIS_BOARDS; do TRAVIS_BOARD=$board tools/build_adafruit_bins.sh || exit $?; done)
|
||||
- echo -en 'travis_fold:end:adafruit-bins\\r'
|
||||
|
||||
- echo 'Building unix' && echo -en 'travis_fold:start:unix\\r'
|
||||
- ([[ $TRAVIS_TEST != "unix" ]] || make -C ports/unix deplibs -j2)
|
||||
- ([[ $TRAVIS_TEST != "unix" ]] || make -C ports/unix -j2)
|
||||
- ([[ $TRAVIS_TEST != "unix" ]] || make -C ports/unix coverage -j2)
|
||||
- (! var_search "${TRAVIS_TESTS-}" unix || (make -C ports/unix deplibs -j2 && make -C ports/unix -j2 && make -C ports/unix coverage -j2))
|
||||
- echo -en 'travis_fold:end:unix\\r'
|
||||
|
||||
# run tests without coverage info
|
||||
@ -96,27 +93,27 @@ script:
|
||||
|
||||
# run tests with coverage info
|
||||
- echo 'Test all' && echo -en 'travis_fold:start:test_all\\r'
|
||||
- ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1))
|
||||
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1))
|
||||
- echo -en 'travis_fold:end:test_all\\r'
|
||||
|
||||
- echo 'Test threads' && echo -en 'travis_fold:start:test_threads\\r'
|
||||
- ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 -d thread))
|
||||
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 -d thread))
|
||||
- echo -en 'travis_fold:end:test_threads\\r'
|
||||
|
||||
- echo 'Testing with native' && echo -en 'travis_fold:start:test_native\\r'
|
||||
- ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native))
|
||||
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native))
|
||||
- echo -en 'travis_fold:end:test_native\\r'
|
||||
|
||||
- (echo 'Testing with mpy' && echo -en 'travis_fold:start:test_mpy\\r')
|
||||
- ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float))
|
||||
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float))
|
||||
- echo -en 'travis_fold:end:test_mpy\\r'
|
||||
|
||||
- (echo 'Building docs' && echo -en 'travis_fold:start:build_docs\\r')
|
||||
- ([[ $TRAVIS_TEST != "docs" ]] || sphinx-build -E -W -b html . _build/html)
|
||||
- (! var_search "${TRAVIS_TESTS-}" docs || sphinx-build -E -W -b html . _build/html)
|
||||
- echo -en 'travis_fold:end:build_docs\\r'
|
||||
|
||||
- (echo 'Building translations' && echo -en 'travis_fold:start:build_translations\\r')
|
||||
- ([[ $TRAVIS_TEST != "translations" ]] || make check-translate)
|
||||
- (! var_search "${TRAVIS_TESTS-}" translations || make check-translate)
|
||||
- echo -en 'travis_fold:end:build_translations\\r'
|
||||
|
||||
# run coveralls coverage analysis (try to, even if some builds/tests failed)
|
||||
|
19
README.rst
19
README.rst
@ -30,13 +30,21 @@ Supported Boards
|
||||
Designed for CircuitPython
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**M0 Boards**
|
||||
|
||||
- `Adafruit CircuitPlayground Express <https://www.adafruit.com/product/3333>`__ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-quickstart>`__)
|
||||
- `Adafruit Feather M0 Express <https://www.adafruit.com/product/3403>`__ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython/kattni-circuitpython>`__)
|
||||
- `Adafruit Metro M0 Express <https://www.adafruit.com/product/3505>`_ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-metro-m0-express-designed-for-circuitpython/circuitpython>`__)
|
||||
- `Adafruit Gemma M0 <https://www.adafruit.com/product/3501>`__ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-gemma-m0/circuitpython>`__)
|
||||
- `Adafruit Hallowing M0 Express <https://www.adafruit.com/product/3900>`__ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-hallowing/circuitpython>`__)
|
||||
- `Adafruit ItsyBitsy M0 Express <https://www.adafruit.com/product/3727>`_ (`CircuitPython Guide <https://learn.adafruit.com/introducing-itsy-bitsy-m0/circuitpython>`__)
|
||||
- `Adafruit Metro M0 Express <https://www.adafruit.com/product/3505>`_ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-metro-m0-express-designed-for-circuitpython/circuitpython>`__)
|
||||
- `Adafruit Trinket M0 <https://www.adafruit.com/product/3500>`__ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-trinket-m0-circuitpython-arduino/circuitpython>`__)
|
||||
- `Adafruit Metro M4 <https://www.adafruit.com/product/3382>`__ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-metro-m4-express-featuring-atsamd51/overview>`__)
|
||||
|
||||
**M4 Boards**
|
||||
|
||||
- `Adafruit Feather M4 Express <https://www.adafruit.com/product/3857>`__ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-feather-m4-express-atsamd51/circuitpython>`__)
|
||||
- `Adafruit ItsyBitsy M4 Express <https://www.adafruit.com/product/3800>`__ (`CircuitPython Guide <https://learn.adafruit.com/introducing-adafruit-itsybitsy-m4/circuitpython>`__)
|
||||
- `Adafruit Metro M4 Express <https://www.adafruit.com/product/3382>`__ (`CircuitPython Guide <https://learn.adafruit.com/adafruit-metro-m4-express-featuring-atsamd51/circuitpython>`__)
|
||||
|
||||
Other
|
||||
~~~~~
|
||||
@ -53,6 +61,13 @@ Other
|
||||
library <https://github.com/adafruit/Adafruit_CircuitPython_SD>`__)
|
||||
- `Arduino Zero <https://www.arduino.cc/en/Main/ArduinoBoardZero>`__
|
||||
|
||||
"Third-party" or "non-Adafruit" boards
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- `Electronic Cats Meow Meow <https://electroniccats.com/gomeow/>`__
|
||||
- `Electronic Cats CatWAN USB Stick <https://electroniccats.com/producto/catwan_usb_stick/>`__
|
||||
|
||||
|
||||
Download
|
||||
--------
|
||||
|
||||
|
3
conf.py
3
conf.py
@ -84,6 +84,7 @@ version = release = '0.0.0'
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = ["**/build*",
|
||||
".venv",
|
||||
".direnv",
|
||||
"docs/README.md",
|
||||
"drivers",
|
||||
"examples",
|
||||
@ -114,7 +115,7 @@ exclude_patterns = ["**/build*",
|
||||
"ports/esp8266/modules",
|
||||
"ports/minimal",
|
||||
"ports/nrf/device",
|
||||
"ports/nrf/drivers",
|
||||
"ports/nrf/bluetooth",
|
||||
"ports/nrf/modules",
|
||||
"ports/nrf/nrfx",
|
||||
"ports/nrf/peripherals",
|
||||
|
@ -67,6 +67,8 @@ These libraries build on top of the low level APIs to simplify common tasks.
|
||||
DC Motor and Servo <https://circuitpython.readthedocs.io/projects/motor/en/latest/>
|
||||
SD Card <https://circuitpython.readthedocs.io/projects/sd/en/latest/>
|
||||
Image Load <https://circuitpython.readthedocs.io/projects/imageload/en/latest/>
|
||||
miniQR Non-hardware QR code generator <https://circuitpython.readthedocs.io/projects/miniqr/en/latest/>
|
||||
Slideshow <https://circuitpython.readthedocs.io/projects/slideshow/en/latest/>
|
||||
LED Animation <https://circuitpython.readthedocs.io/projects/led-animation/en/latest/>
|
||||
|
||||
Blinky
|
||||
@ -115,16 +117,18 @@ Motion relating sensing including ``acceleration``, ``magnetic``, ``gyro``, and
|
||||
|
||||
.. toctree::
|
||||
|
||||
ADXL34x 3 Axis Accelerometer <https://circuitpython.readthedocs.io/projects/adxl34x/en/latest/>
|
||||
BNO055 Accelerometer, Magnetometer, Gyroscope and Absolution Orientation <https://circuitpython.readthedocs.io/projects/bno055/en/latest/>
|
||||
FXAS21002C Gyroscope <https://circuitpython.readthedocs.io/projects/fxas21002c/en/latest/>
|
||||
FXOS8700 Accelerometer <https://circuitpython.readthedocs.io/projects/fxos8700/en/latest/>
|
||||
GPS Global Position <https://circuitpython.readthedocs.io/projects/gps/en/latest/>
|
||||
L3GD20 Gyroscope <https://circuitpython.readthedocs.io/projects/l3gd20/latest/>
|
||||
LIS3DH Accelerometer <https://circuitpython.readthedocs.io/projects/lis3dh/en/latest/>
|
||||
LSM303 Accelerometer and Magnetometer <https://circuitpython.readthedocs.io/projects/lsm303/en/latest/>
|
||||
LSM9DS0 Accelerometer, Magnetometer, Gyroscope and Temperature <https://circuitpython.readthedocs.io/projects/lsm9ds0/en/latest/>
|
||||
LSM9DS1 Accelerometer, Magnetometer, Gyroscope and Temperature <https://circuitpython.readthedocs.io/projects/lsm9ds1/en/latest/>
|
||||
MLX90390 3 Axis Mangetometer <https://circuitpython.readthedocs.io/projects/mlx90393/en/latest/>
|
||||
MMA8451 3 axis accelerometer <https://circuitpython.readthedocs.io/projects/mma8451/en/latest/>
|
||||
L3GD20 Gyroscope <https://circuitpython.readthedocs.io/projects/l3gd20/en/latest/>
|
||||
|
||||
Environmental Sensors
|
||||
----------------------
|
||||
@ -139,13 +143,18 @@ equivalent carbon dioxide (``eco2`` / ``eCO2``), and total volatile organic comp
|
||||
BME280 Temperature, Humidity and Pressure <https://circuitpython.readthedocs.io/projects/bme280/en/latest/>
|
||||
BME680 Temperature, Humidity, Pressure and Gas <https://circuitpython.readthedocs.io/projects/bme680/en/latest/>
|
||||
BMP280 Barometric Pressure and Altitude <https://circuitpython.readthedocs.io/projects/bmp280/en/latest/>
|
||||
BMP3xx Barometric Pressure and Altimeter <https://circuitpython.readthedocs.io/projects/bmp3xx/en/latest/>
|
||||
CCS811 Air Quality <https://circuitpython.readthedocs.io/projects/ccs811/en/latest/>
|
||||
DHT Temperature and Humidity <https://circuitpython.readthedocs.io/projects/dht/en/latest/>
|
||||
DS18x20 Temperature <https://circuitpython.readthedocs.io/projects/ds18x20/en/latest/>
|
||||
HTU21D Temperature and Humidity <https://circuitpython.readthedocs.io/projects/htu21d/en/latest/>
|
||||
MAX31865 Thermocouple Amplifier, Temperature <https://circuitpython.readthedocs.io/projects/max31865/en/latest/>
|
||||
MAX31855 Thermocouple Amplifier, Temperature <https://circuitpython.readthedocs.io/projects/max31855/en/latest/>
|
||||
MAX31856 Thermocouple Amplifier, Temperature <https://circuitpython.readthedocs.io/projects/max31856/en/latest/>
|
||||
MCP9808 Temperature <https://circuitpython.readthedocs.io/projects/mcp9808/en/latest/>
|
||||
MP115A2 Barometric Pressure, Temperature <https://circuitpython.readthedocs.io/projects/mpl115a2/en/latest/>
|
||||
MPL3115A2 Barometric Pressure, Altitude and Temperature Sensor <https://circuitpython.readthedocs.io/projects/mpl3115a2/en/latest/>
|
||||
MPRLS Ported Absolute Pressure <https://circuitpython.readthedocs.io/projects/mprls/en/latest/>
|
||||
SGP30 Air Quality <https://circuitpython.readthedocs.io/projects/sgp30/en/latest/>
|
||||
SHT31-D Temperature and Humidity <https://circuitpython.readthedocs.io/projects/sht31d/en/latest/>
|
||||
Si7021 Temperature and Humidity <https://circuitpython.readthedocs.io/projects/si7021/en/latest/>
|
||||
@ -168,6 +177,7 @@ These sensors detect light related attributes such as ``color``, ``light`` (unit
|
||||
TSL2591 High Dynamic Range Light Sensor <https://circuitpython.readthedocs.io/projects/tsl2591/en/latest/>
|
||||
VCNL4010 Proximity and Light <https://circuitpython.readthedocs.io/projects/vcnl4010/en/latest/>
|
||||
VEML6070 UV Index <https://circuitpython.readthedocs.io/projects/veml6070/en/latest/>
|
||||
VEML6075 UV Index <https://circuitpython.readthedocs.io/projects/veml6075/en/latest/>
|
||||
|
||||
Distance Sensors
|
||||
------------------
|
||||
@ -176,9 +186,11 @@ These sensors measure the ``distance`` to another object and may also measure li
|
||||
|
||||
.. toctree::
|
||||
|
||||
Garmin LIDARLite I2C <https://circuitpython.readthedocs.io/projects/lidarlite/en/latest/>
|
||||
TFmini IR Time of Flight ~30cm - 12m <https://circuitpython.readthedocs.io/projects/tfmini/en/latest/>
|
||||
VL6180x 5 - 100 mm <https://circuitpython.readthedocs.io/projects/vl6180x/en/latest/>
|
||||
VL53L0x ~30 - 1000 mm <https://circuitpython.readthedocs.io/projects/vl53l0x/en/latest/>
|
||||
HC-SR04 ultrasonic range sensors <https://circuitpython.readthedocs.io/projects/hcsr04/en/latest/>
|
||||
HC-SR04 Ultrasonic Range Sensors <https://circuitpython.readthedocs.io/projects/hcsr04/en/latest/>
|
||||
|
||||
Radio
|
||||
--------
|
||||
@ -187,6 +199,7 @@ These chips communicate to other's over radio.
|
||||
|
||||
.. toctree::
|
||||
|
||||
Adafruit Bluefruit LE SPI Friend <https://circuitpython.readthedocs.io/projects/bluefruitspi/en/latest/>
|
||||
RFM9x LoRa <https://circuitpython.readthedocs.io/projects/rfm9x/en/latest/>
|
||||
RFM69 Packet Radio <https://circuitpython.readthedocs.io/projects/rfm69/en/latest/>
|
||||
PN532 NFC/RFID <https://circuitpython.readthedocs.io/projects/pn532/en/latest/>
|
||||
@ -217,9 +230,12 @@ Miscellaneous
|
||||
|
||||
.. toctree::
|
||||
|
||||
CAP1188 8-Key Capacitive Touch <https://circuitpython.readthedocs.io/projects/cap1188/en/latest/>
|
||||
Si4713 Stereo FM Transmitter <https://circuitpython.readthedocs.io/projects/si4713/en/latest/>
|
||||
AMG88xx Grid-Eye IR Camera <https://circuitpython.readthedocs.io/projects/amg88xx/en/latest/>
|
||||
Trellis 4x4 Keypad <https://circuitpython.readthedocs.io/projects/trellis/en/latest/>
|
||||
NeoTrellis 4x4 Keypad <https://circuitpython.readthedocs.io/projects/neotrellis/en/latest/>
|
||||
NeoTrellis M4 4x8 Keypad <https://circuitpython.readthedocs.io/projects/trellism4/en/latest/>
|
||||
DRV2605 Haptic Motor Controller <https://circuitpython.readthedocs.io/projects/drv2605/en/latest/>
|
||||
MAX9744 Audio Amplifier <https://circuitpython.readthedocs.io/projects/max9744/en/latest/>
|
||||
Si5351 Clock Generator <https://circuitpython.readthedocs.io/projects/si5351/en/latest/>
|
||||
@ -229,3 +245,6 @@ Miscellaneous
|
||||
Fingerprint <https://circuitpython.readthedocs.io/projects/fingerprint/en/latest/>
|
||||
STMPE610 Resistive Touchscreen <https://circuitpython.readthedocs.io/projects/stmpe610/en/latest/>
|
||||
Matrix Keypad <https://circuitpython.readthedocs.io/projects/matrixkeypad/en/latest/>
|
||||
VS1053 Audio Codec <https://circuitpython.readthedocs.io/projects/vs1053/en/latest/>
|
||||
FRAM Non-Volatile Memory <https://circuitpython.readthedocs.io/projects/fram/en/latest/>
|
||||
74HC595 Shift Register <https://circuitpython.readthedocs.io/projects/74hc595/en/latest/>
|
||||
|
@ -138,16 +138,16 @@ Constants
|
||||
Note that you don't need to specify these in a call to `usocket.socket()`,
|
||||
because `SOCK_STREAM` socket type automatically selects `IPPROTO_TCP`, and
|
||||
`SOCK_DGRAM` - `IPPROTO_UDP`. Thus, the only real use of these constants
|
||||
is as an argument to `setsockopt()`.
|
||||
is as an argument to `usocket.socket.setsockopt()`.
|
||||
|
||||
.. data:: usocket.SOL_*
|
||||
|
||||
Socket option levels (an argument to `setsockopt()`). The exact
|
||||
Socket option levels (an argument to `usocket.socket.setsockopt()`). The exact
|
||||
inventory depends on a ``MicroPython port``.
|
||||
|
||||
.. data:: usocket.SO_*
|
||||
|
||||
Socket options (an argument to `setsockopt()`). The exact
|
||||
Socket options (an argument to `usocket.socket.setsockopt()`). The exact
|
||||
inventory depends on a ``MicroPython port``.
|
||||
|
||||
Constants specific to WiPy:
|
||||
|
6
drivers/wiznet5k/README.md
Normal file
6
drivers/wiznet5k/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
This is the driver for the WIZnet5x00 series of Ethernet controllers.
|
||||
|
||||
Adapted for MicroPython.
|
||||
|
||||
Original source: https://github.com/Wiznet/W5500_EVB/tree/master/ioLibrary
|
||||
Taken on: 30 August 2014
|
718
drivers/wiznet5k/ethernet/socket.c
Normal file
718
drivers/wiznet5k/ethernet/socket.c
Normal file
@ -0,0 +1,718 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \file socket.c
|
||||
//! \brief SOCKET APIs Implements file.
|
||||
//! \details SOCKET APIs like as Berkeley Socket APIs.
|
||||
//! \version 1.0.3
|
||||
//! \date 2013/10/21
|
||||
//! \par Revision history
|
||||
//! <2018/10/09> Nick Moore fixes for CircuitPython
|
||||
//! <2014/05/01> V1.0.3. Refer to M20140501
|
||||
//! 1. Implicit type casting -> Explicit type casting.
|
||||
//! 2. replace 0x01 with PACK_REMAINED in recvfrom()
|
||||
//! 3. Validation a destination ip in connect() & sendto():
|
||||
//! It occurs a fatal error on converting unint32 address if uint8* addr parameter is not aligned by 4byte address.
|
||||
//! Copy 4 byte addr value into temporary uint32 variable and then compares it.
|
||||
//! <2013/12/20> V1.0.2 Refer to M20131220
|
||||
//! Remove Warning.
|
||||
//! <2013/11/04> V1.0.1 2nd Release. Refer to "20131104".
|
||||
//! In sendto(), Add to clear timeout interrupt status (Sn_IR_TIMEOUT)
|
||||
//! <2013/10/21> 1st Release
|
||||
//! \author MidnightCow
|
||||
//! \copyright
|
||||
//!
|
||||
//! Copyright (c) 2013, WIZnet Co., LTD.
|
||||
//! All rights reserved.
|
||||
//!
|
||||
//! Redistribution and use in source and binary forms, with or without
|
||||
//! modification, are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * Redistributions of source code must retain the above copyright
|
||||
//! notice, this list of conditions and the following disclaimer.
|
||||
//! * 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.
|
||||
//! * Neither the name of the <ORGANIZATION> nor the names of its
|
||||
//! contributors may be used to endorse or promote products derived
|
||||
//! from this software without specific prior written permission.
|
||||
//!
|
||||
//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 <string.h>
|
||||
|
||||
#include "py/mpthread.h"
|
||||
#include "socket.h"
|
||||
|
||||
#define SOCK_ANY_PORT_NUM 0xC000;
|
||||
|
||||
static uint16_t sock_any_port = SOCK_ANY_PORT_NUM;
|
||||
static uint16_t sock_io_mode = 0;
|
||||
static uint16_t sock_is_sending = 0;
|
||||
static uint16_t sock_remained_size[_WIZCHIP_SOCK_NUM_] = {0,0,};
|
||||
static uint8_t sock_pack_info[_WIZCHIP_SOCK_NUM_] = {0,};
|
||||
|
||||
#if _WIZCHIP_ == 5200
|
||||
static uint16_t sock_next_rd[_WIZCHIP_SOCK_NUM_] ={0,};
|
||||
#endif
|
||||
|
||||
#define CHECK_SOCKNUM() \
|
||||
do{ \
|
||||
if(sn > _WIZCHIP_SOCK_NUM_) return SOCKERR_SOCKNUM; \
|
||||
}while(0); \
|
||||
|
||||
#define CHECK_SOCKMODE(mode) \
|
||||
do{ \
|
||||
if((getSn_MR(sn) & 0x0F) != mode) return SOCKERR_SOCKMODE; \
|
||||
}while(0); \
|
||||
|
||||
#define CHECK_SOCKINIT() \
|
||||
do{ \
|
||||
if((getSn_SR(sn) != SOCK_INIT)) return SOCKERR_SOCKINIT; \
|
||||
}while(0); \
|
||||
|
||||
#define CHECK_SOCKDATA() \
|
||||
do{ \
|
||||
if(len == 0) return SOCKERR_DATALEN; \
|
||||
}while(0); \
|
||||
|
||||
void WIZCHIP_EXPORT(socket_reset)(void) {
|
||||
sock_any_port = SOCK_ANY_PORT_NUM;
|
||||
sock_io_mode = 0;
|
||||
sock_is_sending = 0;
|
||||
/*
|
||||
memset(sock_remained_size, 0, _WIZCHIP_SOCK_NUM_ * sizeof(uint16_t));
|
||||
memset(sock_pack_info, 0, _WIZCHIP_SOCK_NUM_ * sizeof(uint8_t));
|
||||
*/
|
||||
|
||||
#if _WIZCHIP_ == 5200
|
||||
memset(sock_next_rd, 0, _WIZCHIP_SOCK_NUM_ * sizeof(uint16_t));
|
||||
#endif
|
||||
}
|
||||
|
||||
int8_t WIZCHIP_EXPORT(socket)(uint8_t sn, uint8_t protocol, uint16_t port, uint8_t flag)
|
||||
{
|
||||
CHECK_SOCKNUM();
|
||||
switch(protocol)
|
||||
{
|
||||
case Sn_MR_TCP :
|
||||
case Sn_MR_UDP :
|
||||
case Sn_MR_MACRAW :
|
||||
break;
|
||||
#if ( _WIZCHIP_ < 5200 )
|
||||
case Sn_MR_IPRAW :
|
||||
case Sn_MR_PPPoE :
|
||||
break;
|
||||
#endif
|
||||
default :
|
||||
return SOCKERR_SOCKMODE;
|
||||
}
|
||||
if((flag & 0x06) != 0) return SOCKERR_SOCKFLAG;
|
||||
#if _WIZCHIP_ == 5200
|
||||
if(flag & 0x10) return SOCKERR_SOCKFLAG;
|
||||
#endif
|
||||
|
||||
if(flag != 0)
|
||||
{
|
||||
switch(protocol)
|
||||
{
|
||||
case Sn_MR_TCP:
|
||||
if((flag & (SF_TCP_NODELAY|SF_IO_NONBLOCK))==0) return SOCKERR_SOCKFLAG;
|
||||
break;
|
||||
case Sn_MR_UDP:
|
||||
if(flag & SF_IGMP_VER2)
|
||||
{
|
||||
if((flag & SF_MULTI_ENABLE)==0) return SOCKERR_SOCKFLAG;
|
||||
}
|
||||
#if _WIZCHIP_ == 5500
|
||||
if(flag & SF_UNI_BLOCK)
|
||||
{
|
||||
if((flag & SF_MULTI_ENABLE) == 0) return SOCKERR_SOCKFLAG;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
WIZCHIP_EXPORT(close)(sn);
|
||||
setSn_MR(sn, (protocol | (flag & 0xF0)));
|
||||
if(!port)
|
||||
{
|
||||
port = sock_any_port++;
|
||||
if(sock_any_port == 0xFFF0) sock_any_port = SOCK_ANY_PORT_NUM;
|
||||
}
|
||||
setSn_PORT(sn,port);
|
||||
setSn_CR(sn,Sn_CR_OPEN);
|
||||
while(getSn_CR(sn));
|
||||
sock_io_mode |= ((flag & SF_IO_NONBLOCK) << sn);
|
||||
sock_is_sending &= ~(1<<sn);
|
||||
sock_remained_size[sn] = 0;
|
||||
sock_pack_info[sn] = 0;
|
||||
while(getSn_SR(sn) == SOCK_CLOSED);
|
||||
return (int8_t)sn;
|
||||
}
|
||||
|
||||
int8_t WIZCHIP_EXPORT(close)(uint8_t sn)
|
||||
{
|
||||
CHECK_SOCKNUM();
|
||||
|
||||
setSn_CR(sn,Sn_CR_CLOSE);
|
||||
/* wait to process the command... */
|
||||
while( getSn_CR(sn) );
|
||||
/* clear all interrupt of the socket. */
|
||||
setSn_IR(sn, 0xFF);
|
||||
sock_is_sending &= ~(1<<sn);
|
||||
sock_remained_size[sn] = 0;
|
||||
sock_pack_info[sn] = 0;
|
||||
while(getSn_SR(sn) != SOCK_CLOSED);
|
||||
return SOCK_OK;
|
||||
}
|
||||
|
||||
int8_t WIZCHIP_EXPORT(listen)(uint8_t sn)
|
||||
{
|
||||
CHECK_SOCKNUM();
|
||||
CHECK_SOCKMODE(Sn_MR_TCP);
|
||||
CHECK_SOCKINIT();
|
||||
setSn_CR(sn,Sn_CR_LISTEN);
|
||||
while(getSn_CR(sn));
|
||||
while(getSn_SR(sn) != SOCK_LISTEN)
|
||||
{
|
||||
if(getSn_CR(sn) == SOCK_CLOSED)
|
||||
{
|
||||
WIZCHIP_EXPORT(close)(sn);
|
||||
return SOCKERR_SOCKCLOSED;
|
||||
}
|
||||
}
|
||||
return SOCK_OK;
|
||||
}
|
||||
|
||||
|
||||
int8_t WIZCHIP_EXPORT(connect)(uint8_t sn, uint8_t * addr, uint16_t port)
|
||||
{
|
||||
CHECK_SOCKNUM();
|
||||
CHECK_SOCKMODE(Sn_MR_TCP);
|
||||
CHECK_SOCKINIT();
|
||||
//M20140501 : For avoiding fatal error on memory align mismatched
|
||||
//if( *((uint32_t*)addr) == 0xFFFFFFFF || *((uint32_t*)addr) == 0) return SOCKERR_IPINVALID;
|
||||
{
|
||||
uint32_t taddr;
|
||||
taddr = ((uint32_t)addr[0] & 0x000000FF);
|
||||
taddr = (taddr << 8) + ((uint32_t)addr[1] & 0x000000FF);
|
||||
taddr = (taddr << 8) + ((uint32_t)addr[2] & 0x000000FF);
|
||||
taddr = (taddr << 8) + ((uint32_t)addr[3] & 0x000000FF);
|
||||
if (taddr == 0xFFFFFFFF || taddr == 0) return SOCKERR_IPINVALID;
|
||||
}
|
||||
//
|
||||
|
||||
if(port == 0) return SOCKERR_PORTZERO;
|
||||
setSn_DIPR(sn,addr);
|
||||
setSn_DPORT(sn,port);
|
||||
#if _WIZCHIP_ == 5200 // for W5200 ARP errata
|
||||
setSUBR(wizchip_getsubn());
|
||||
#endif
|
||||
setSn_CR(sn,Sn_CR_CONNECT);
|
||||
while(getSn_CR(sn));
|
||||
if(sock_io_mode & (1<<sn)) return SOCK_BUSY;
|
||||
while(getSn_SR(sn) != SOCK_ESTABLISHED)
|
||||
{
|
||||
if (getSn_SR(sn) == SOCK_CLOSED) {
|
||||
#if _WIZCHIP_ == 5200 // for W5200 ARP errata
|
||||
setSUBR((uint8_t*)"\x00\x00\x00\x00");
|
||||
#endif
|
||||
return SOCKERR_SOCKCLOSED;
|
||||
}
|
||||
if (getSn_IR(sn) & Sn_IR_TIMEOUT)
|
||||
{
|
||||
setSn_IR(sn, Sn_IR_TIMEOUT);
|
||||
#if _WIZCHIP_ == 5200 // for W5200 ARP errata
|
||||
setSUBR((uint8_t*)"\x00\x00\x00\x00");
|
||||
#endif
|
||||
return SOCKERR_TIMEOUT;
|
||||
}
|
||||
MICROPY_THREAD_YIELD();
|
||||
}
|
||||
#if _WIZCHIP_ == 5200 // for W5200 ARP errata
|
||||
setSUBR((uint8_t*)"\x00\x00\x00\x00");
|
||||
#endif
|
||||
|
||||
return SOCK_OK;
|
||||
}
|
||||
|
||||
int8_t WIZCHIP_EXPORT(disconnect)(uint8_t sn)
|
||||
{
|
||||
CHECK_SOCKNUM();
|
||||
CHECK_SOCKMODE(Sn_MR_TCP);
|
||||
setSn_CR(sn,Sn_CR_DISCON);
|
||||
/* wait to process the command... */
|
||||
while(getSn_CR(sn));
|
||||
sock_is_sending &= ~(1<<sn);
|
||||
if(sock_io_mode & (1<<sn)) return SOCK_BUSY;
|
||||
while(getSn_SR(sn) != SOCK_CLOSED)
|
||||
{
|
||||
if(getSn_IR(sn) & Sn_IR_TIMEOUT)
|
||||
{
|
||||
WIZCHIP_EXPORT(close)(sn);
|
||||
return SOCKERR_TIMEOUT;
|
||||
}
|
||||
}
|
||||
return SOCK_OK;
|
||||
}
|
||||
|
||||
int32_t WIZCHIP_EXPORT(send)(uint8_t sn, uint8_t * buf, uint16_t len)
|
||||
{
|
||||
uint8_t tmp=0;
|
||||
uint16_t freesize=0;
|
||||
|
||||
CHECK_SOCKNUM();
|
||||
CHECK_SOCKMODE(Sn_MR_TCP);
|
||||
CHECK_SOCKDATA();
|
||||
tmp = getSn_SR(sn);
|
||||
if(tmp != SOCK_ESTABLISHED && tmp != SOCK_CLOSE_WAIT) return SOCKERR_SOCKSTATUS;
|
||||
if( sock_is_sending & (1<<sn) )
|
||||
{
|
||||
tmp = getSn_IR(sn);
|
||||
if(tmp & Sn_IR_SENDOK)
|
||||
{
|
||||
setSn_IR(sn, Sn_IR_SENDOK);
|
||||
#if _WIZCHIP_ == 5200
|
||||
if(getSn_TX_RD(sn) != sock_next_rd[sn])
|
||||
{
|
||||
setSn_CR(sn,Sn_CR_SEND);
|
||||
while(getSn_CR(sn));
|
||||
return SOCKERR_BUSY;
|
||||
}
|
||||
#endif
|
||||
sock_is_sending &= ~(1<<sn);
|
||||
}
|
||||
else if(tmp & Sn_IR_TIMEOUT)
|
||||
{
|
||||
WIZCHIP_EXPORT(close)(sn);
|
||||
return SOCKERR_TIMEOUT;
|
||||
}
|
||||
else return SOCK_BUSY;
|
||||
}
|
||||
freesize = getSn_TxMAX(sn);
|
||||
if (len > freesize) len = freesize; // check size not to exceed MAX size.
|
||||
while(1)
|
||||
{
|
||||
freesize = getSn_TX_FSR(sn);
|
||||
tmp = getSn_SR(sn);
|
||||
if ((tmp != SOCK_ESTABLISHED) && (tmp != SOCK_CLOSE_WAIT))
|
||||
{
|
||||
WIZCHIP_EXPORT(close)(sn);
|
||||
return SOCKERR_SOCKSTATUS;
|
||||
}
|
||||
if( (sock_io_mode & (1<<sn)) && (len > freesize) ) return SOCK_BUSY;
|
||||
if(len <= freesize) break;
|
||||
MICROPY_THREAD_YIELD();
|
||||
}
|
||||
wiz_send_data(sn, buf, len);
|
||||
#if _WIZCHIP_ == 5200
|
||||
sock_next_rd[sn] = getSn_TX_RD(sn) + len;
|
||||
#endif
|
||||
setSn_CR(sn,Sn_CR_SEND);
|
||||
/* wait to process the command... */
|
||||
while(getSn_CR(sn));
|
||||
sock_is_sending |= (1 << sn);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
int32_t WIZCHIP_EXPORT(recv)(uint8_t sn, uint8_t * buf, uint16_t len)
|
||||
{
|
||||
uint8_t tmp = 0;
|
||||
uint16_t recvsize = 0;
|
||||
CHECK_SOCKNUM();
|
||||
CHECK_SOCKMODE(Sn_MR_TCP);
|
||||
CHECK_SOCKDATA();
|
||||
|
||||
recvsize = getSn_RxMAX(sn);
|
||||
if(recvsize < len) len = recvsize;
|
||||
while(1)
|
||||
{
|
||||
recvsize = getSn_RX_RSR(sn);
|
||||
tmp = getSn_SR(sn);
|
||||
if (tmp != SOCK_ESTABLISHED)
|
||||
{
|
||||
if(tmp == SOCK_CLOSE_WAIT)
|
||||
{
|
||||
if(recvsize != 0) break;
|
||||
else if(getSn_TX_FSR(sn) == getSn_TxMAX(sn))
|
||||
{
|
||||
// dpgeorge: Getting here seems to be an orderly shutdown of the
|
||||
// socket, and trying to get POSIX behaviour we return 0 because:
|
||||
// "If no messages are available to be received and the peer has per‐
|
||||
// formed an orderly shutdown, recv() shall return 0".
|
||||
// TODO this return value clashes with SOCK_BUSY in non-blocking mode.
|
||||
WIZCHIP_EXPORT(close)(sn);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WIZCHIP_EXPORT(close)(sn);
|
||||
return SOCKERR_SOCKSTATUS;
|
||||
}
|
||||
}
|
||||
if((sock_io_mode & (1<<sn)) && (recvsize == 0)) return SOCK_BUSY;
|
||||
if(recvsize != 0) break;
|
||||
MICROPY_THREAD_YIELD();
|
||||
};
|
||||
if(recvsize < len) len = recvsize;
|
||||
wiz_recv_data(sn, buf, len);
|
||||
setSn_CR(sn,Sn_CR_RECV);
|
||||
while(getSn_CR(sn));
|
||||
return len;
|
||||
}
|
||||
|
||||
int32_t WIZCHIP_EXPORT(sendto)(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port)
|
||||
{
|
||||
uint8_t tmp = 0;
|
||||
uint16_t freesize = 0;
|
||||
CHECK_SOCKNUM();
|
||||
switch(getSn_MR(sn) & 0x0F)
|
||||
{
|
||||
case Sn_MR_UDP:
|
||||
case Sn_MR_MACRAW:
|
||||
break;
|
||||
default:
|
||||
return SOCKERR_SOCKMODE;
|
||||
}
|
||||
CHECK_SOCKDATA();
|
||||
//M20140501 : For avoiding fatal error on memory align mismatched
|
||||
//if(*((uint32_t*)addr) == 0) return SOCKERR_IPINVALID;
|
||||
if ((addr[0] | addr[1] | addr[2] | addr[3]) == 0) return SOCKERR_IPINVALID;
|
||||
if(port == 0) return SOCKERR_PORTZERO;
|
||||
tmp = getSn_SR(sn);
|
||||
if(tmp != SOCK_MACRAW && tmp != SOCK_UDP) return SOCKERR_SOCKSTATUS;
|
||||
|
||||
setSn_DIPR(sn,addr);
|
||||
setSn_DPORT(sn,port);
|
||||
freesize = getSn_TxMAX(sn);
|
||||
if (len > freesize) len = freesize; // check size not to exceed MAX size.
|
||||
while(1)
|
||||
{
|
||||
freesize = getSn_TX_FSR(sn);
|
||||
if(getSn_SR(sn) == SOCK_CLOSED) return SOCKERR_SOCKCLOSED;
|
||||
if( (sock_io_mode & (1<<sn)) && (len > freesize) ) return SOCK_BUSY;
|
||||
if(len <= freesize) break;
|
||||
MICROPY_THREAD_YIELD();
|
||||
};
|
||||
wiz_send_data(sn, buf, len);
|
||||
|
||||
#if _WIZCHIP_ == 5200 // for W5200 ARP errata
|
||||
setSUBR(wizchip_getsubn());
|
||||
#endif
|
||||
|
||||
setSn_CR(sn,Sn_CR_SEND);
|
||||
/* wait to process the command... */
|
||||
while(getSn_CR(sn));
|
||||
while(1)
|
||||
{
|
||||
tmp = getSn_IR(sn);
|
||||
if(tmp & Sn_IR_SENDOK)
|
||||
{
|
||||
setSn_IR(sn, Sn_IR_SENDOK);
|
||||
break;
|
||||
}
|
||||
//M:20131104
|
||||
//else if(tmp & Sn_IR_TIMEOUT) return SOCKERR_TIMEOUT;
|
||||
else if(tmp & Sn_IR_TIMEOUT)
|
||||
{
|
||||
setSn_IR(sn, Sn_IR_TIMEOUT);
|
||||
#if _WIZCHIP_ == 5200 // for W5200 ARP errata
|
||||
setSUBR((uint8_t*)"\x00\x00\x00\x00");
|
||||
#endif
|
||||
return SOCKERR_TIMEOUT;
|
||||
}
|
||||
////////////
|
||||
MICROPY_THREAD_YIELD();
|
||||
}
|
||||
#if _WIZCHIP_ == 5200 // for W5200 ARP errata
|
||||
setSUBR((uint8_t*)"\x00\x00\x00\x00");
|
||||
#endif
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int32_t WIZCHIP_EXPORT(recvfrom)(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t *port)
|
||||
{
|
||||
uint8_t mr;
|
||||
uint8_t head[8];
|
||||
uint16_t pack_len=0;
|
||||
|
||||
CHECK_SOCKNUM();
|
||||
//CHECK_SOCKMODE(Sn_MR_UDP);
|
||||
switch((mr=getSn_MR(sn)) & 0x0F)
|
||||
{
|
||||
case Sn_MR_UDP:
|
||||
case Sn_MR_MACRAW:
|
||||
break;
|
||||
#if ( _WIZCHIP_ < 5200 )
|
||||
case Sn_MR_IPRAW:
|
||||
case Sn_MR_PPPoE:
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return SOCKERR_SOCKMODE;
|
||||
}
|
||||
CHECK_SOCKDATA();
|
||||
if(sock_remained_size[sn] == 0)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
pack_len = getSn_RX_RSR(sn);
|
||||
if(getSn_SR(sn) == SOCK_CLOSED) return SOCKERR_SOCKCLOSED;
|
||||
if( (sock_io_mode & (1<<sn)) && (pack_len == 0) ) return SOCK_BUSY;
|
||||
if(pack_len != 0) break;
|
||||
MICROPY_THREAD_YIELD();
|
||||
};
|
||||
}
|
||||
sock_pack_info[sn] = PACK_COMPLETED;
|
||||
switch (mr & 0x07)
|
||||
{
|
||||
case Sn_MR_UDP :
|
||||
if(sock_remained_size[sn] == 0)
|
||||
{
|
||||
wiz_recv_data(sn, head, 8);
|
||||
setSn_CR(sn,Sn_CR_RECV);
|
||||
while(getSn_CR(sn));
|
||||
// read peer's IP address, port number & packet length
|
||||
addr[0] = head[0];
|
||||
addr[1] = head[1];
|
||||
addr[2] = head[2];
|
||||
addr[3] = head[3];
|
||||
*port = head[4];
|
||||
*port = (*port << 8) + head[5];
|
||||
sock_remained_size[sn] = head[6];
|
||||
sock_remained_size[sn] = (sock_remained_size[sn] << 8) + head[7];
|
||||
sock_pack_info[sn] = PACK_FIRST;
|
||||
}
|
||||
if(len < sock_remained_size[sn]) pack_len = len;
|
||||
else pack_len = sock_remained_size[sn];
|
||||
//
|
||||
// Need to packet length check (default 1472)
|
||||
//
|
||||
wiz_recv_data(sn, buf, pack_len); // data copy.
|
||||
break;
|
||||
case Sn_MR_MACRAW :
|
||||
if(sock_remained_size[sn] == 0)
|
||||
{
|
||||
wiz_recv_data(sn, head, 2);
|
||||
setSn_CR(sn,Sn_CR_RECV);
|
||||
while(getSn_CR(sn));
|
||||
// read peer's IP address, port number & packet length
|
||||
sock_remained_size[sn] = head[0];
|
||||
sock_remained_size[sn] = (sock_remained_size[sn] <<8) + head[1];
|
||||
sock_remained_size[sn] -= 2; // len includes 2 len bytes
|
||||
if(sock_remained_size[sn] > 1514)
|
||||
{
|
||||
WIZCHIP_EXPORT(close)(sn);
|
||||
return SOCKFATAL_PACKLEN;
|
||||
}
|
||||
sock_pack_info[sn] = PACK_FIRST;
|
||||
}
|
||||
if(len < sock_remained_size[sn]) pack_len = len;
|
||||
else pack_len = sock_remained_size[sn];
|
||||
wiz_recv_data(sn,buf,pack_len);
|
||||
break;
|
||||
#if ( _WIZCHIP_ < 5200 )
|
||||
case Sn_MR_IPRAW:
|
||||
if(sock_remained_size[sn] == 0)
|
||||
{
|
||||
wiz_recv_data(sn, head, 6);
|
||||
setSn_CR(sn,Sn_CR_RECV);
|
||||
while(getSn_CR(sn));
|
||||
addr[0] = head[0];
|
||||
addr[1] = head[1];
|
||||
addr[2] = head[2];
|
||||
addr[3] = head[3];
|
||||
sock_remained_size[sn] = head[4];
|
||||
sock_remaiend_size[sn] = (sock_remained_size[sn] << 8) + head[5];
|
||||
sock_pack_info[sn] = PACK_FIRST;
|
||||
}
|
||||
//
|
||||
// Need to packet length check
|
||||
//
|
||||
if(len < sock_remained_size[sn]) pack_len = len;
|
||||
else pack_len = sock_remained_size[sn];
|
||||
wiz_recv_data(sn, buf, pack_len); // data copy.
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
wiz_recv_ignore(sn, pack_len); // data copy.
|
||||
sock_remained_size[sn] = pack_len;
|
||||
break;
|
||||
}
|
||||
setSn_CR(sn,Sn_CR_RECV);
|
||||
/* wait to process the command... */
|
||||
while(getSn_CR(sn)) ;
|
||||
sock_remained_size[sn] -= pack_len;
|
||||
//M20140501 : replace 0x01 with PACK_REMAINED
|
||||
//if(sock_remained_size[sn] != 0) sock_pack_info[sn] |= 0x01;
|
||||
if(sock_remained_size[sn] != 0) sock_pack_info[sn] |= PACK_REMAINED;
|
||||
//
|
||||
return pack_len;
|
||||
}
|
||||
|
||||
|
||||
int8_t WIZCHIP_EXPORT(ctlsocket)(uint8_t sn, ctlsock_type cstype, void* arg)
|
||||
{
|
||||
uint8_t tmp = 0;
|
||||
CHECK_SOCKNUM();
|
||||
switch(cstype)
|
||||
{
|
||||
case CS_SET_IOMODE:
|
||||
tmp = *((uint8_t*)arg);
|
||||
if(tmp == SOCK_IO_NONBLOCK) sock_io_mode |= (1<<sn);
|
||||
else if(tmp == SOCK_IO_BLOCK) sock_io_mode &= ~(1<<sn);
|
||||
else return SOCKERR_ARG;
|
||||
break;
|
||||
case CS_GET_IOMODE:
|
||||
//M20140501 : implict type casting -> explict type casting
|
||||
//*((uint8_t*)arg) = (sock_io_mode >> sn) & 0x0001;
|
||||
*((uint8_t*)arg) = (uint8_t)((sock_io_mode >> sn) & 0x0001);
|
||||
//
|
||||
break;
|
||||
case CS_GET_MAXTXBUF:
|
||||
*((uint16_t*)arg) = getSn_TxMAX(sn);
|
||||
break;
|
||||
case CS_GET_MAXRXBUF:
|
||||
*((uint16_t*)arg) = getSn_RxMAX(sn);
|
||||
break;
|
||||
case CS_CLR_INTERRUPT:
|
||||
if( (*(uint8_t*)arg) > SIK_ALL) return SOCKERR_ARG;
|
||||
setSn_IR(sn,*(uint8_t*)arg);
|
||||
break;
|
||||
case CS_GET_INTERRUPT:
|
||||
*((uint8_t*)arg) = getSn_IR(sn);
|
||||
break;
|
||||
case CS_SET_INTMASK:
|
||||
if( (*(uint8_t*)arg) > SIK_ALL) return SOCKERR_ARG;
|
||||
setSn_IMR(sn,*(uint8_t*)arg);
|
||||
break;
|
||||
case CS_GET_INTMASK:
|
||||
*((uint8_t*)arg) = getSn_IMR(sn);
|
||||
default:
|
||||
return SOCKERR_ARG;
|
||||
}
|
||||
return SOCK_OK;
|
||||
}
|
||||
|
||||
int8_t WIZCHIP_EXPORT(setsockopt)(uint8_t sn, sockopt_type sotype, void* arg)
|
||||
{
|
||||
// M20131220 : Remove warning
|
||||
//uint8_t tmp;
|
||||
CHECK_SOCKNUM();
|
||||
switch(sotype)
|
||||
{
|
||||
case SO_TTL:
|
||||
setSn_TTL(sn,*(uint8_t*)arg);
|
||||
break;
|
||||
case SO_TOS:
|
||||
setSn_TOS(sn,*(uint8_t*)arg);
|
||||
break;
|
||||
case SO_MSS:
|
||||
setSn_MSSR(sn,*(uint16_t*)arg);
|
||||
break;
|
||||
case SO_DESTIP:
|
||||
setSn_DIPR(sn, (uint8_t*)arg);
|
||||
break;
|
||||
case SO_DESTPORT:
|
||||
setSn_DPORT(sn, *(uint16_t*)arg);
|
||||
break;
|
||||
#if _WIZCHIP_ != 5100
|
||||
case SO_KEEPALIVESEND:
|
||||
CHECK_SOCKMODE(Sn_MR_TCP);
|
||||
#if _WIZCHIP_ > 5200
|
||||
if(getSn_KPALVTR(sn) != 0) return SOCKERR_SOCKOPT;
|
||||
#endif
|
||||
setSn_CR(sn,Sn_CR_SEND_KEEP);
|
||||
while(getSn_CR(sn) != 0)
|
||||
{
|
||||
// M20131220
|
||||
//if ((tmp = getSn_IR(sn)) & Sn_IR_TIMEOUT)
|
||||
if (getSn_IR(sn) & Sn_IR_TIMEOUT)
|
||||
{
|
||||
setSn_IR(sn, Sn_IR_TIMEOUT);
|
||||
return SOCKERR_TIMEOUT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#if _WIZCHIP_ > 5200
|
||||
case SO_KEEPALIVEAUTO:
|
||||
CHECK_SOCKMODE(Sn_MR_TCP);
|
||||
setSn_KPALVTR(sn,*(uint8_t*)arg);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
return SOCKERR_ARG;
|
||||
}
|
||||
return SOCK_OK;
|
||||
}
|
||||
|
||||
int8_t WIZCHIP_EXPORT(getsockopt)(uint8_t sn, sockopt_type sotype, void* arg)
|
||||
{
|
||||
CHECK_SOCKNUM();
|
||||
switch(sotype)
|
||||
{
|
||||
case SO_FLAG:
|
||||
*(uint8_t*)arg = getSn_MR(sn) & 0xF0;
|
||||
break;
|
||||
case SO_TTL:
|
||||
*(uint8_t*) arg = getSn_TTL(sn);
|
||||
break;
|
||||
case SO_TOS:
|
||||
*(uint8_t*) arg = getSn_TOS(sn);
|
||||
break;
|
||||
case SO_MSS:
|
||||
*(uint8_t*) arg = getSn_MSSR(sn);
|
||||
case SO_DESTIP:
|
||||
getSn_DIPR(sn, (uint8_t*)arg);
|
||||
break;
|
||||
case SO_DESTPORT:
|
||||
*(uint16_t*) arg = getSn_DPORT(sn);
|
||||
break;
|
||||
#if _WIZCHIP_ > 5200
|
||||
case SO_KEEPALIVEAUTO:
|
||||
CHECK_SOCKMODE(Sn_MR_TCP);
|
||||
*(uint16_t*) arg = getSn_KPALVTR(sn);
|
||||
break;
|
||||
#endif
|
||||
case SO_SENDBUF:
|
||||
*(uint16_t*) arg = getSn_TX_FSR(sn);
|
||||
case SO_RECVBUF:
|
||||
*(uint16_t*) arg = getSn_RX_RSR(sn);
|
||||
case SO_STATUS:
|
||||
*(uint8_t*) arg = getSn_SR(sn);
|
||||
break;
|
||||
case SO_REMAINSIZE:
|
||||
if(getSn_MR(sn) == Sn_MR_TCP)
|
||||
*(uint16_t*)arg = getSn_RX_RSR(sn);
|
||||
else
|
||||
*(uint16_t*)arg = sock_remained_size[sn];
|
||||
break;
|
||||
case SO_PACKINFO:
|
||||
CHECK_SOCKMODE(Sn_MR_TCP);
|
||||
*(uint8_t*)arg = sock_pack_info[sn];
|
||||
break;
|
||||
default:
|
||||
return SOCKERR_SOCKOPT;
|
||||
}
|
||||
return SOCK_OK;
|
||||
}
|
472
drivers/wiznet5k/ethernet/socket.h
Normal file
472
drivers/wiznet5k/ethernet/socket.h
Normal file
@ -0,0 +1,472 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \file socket.h
|
||||
//! \brief SOCKET APIs Header file.
|
||||
//! \details SOCKET APIs like as berkeley socket api.
|
||||
//! \version 1.0.2
|
||||
//! \date 2013/10/21
|
||||
//! \par Revision history
|
||||
//! <2014/05/01> V1.0.2. Refer to M20140501
|
||||
//! 1. Modify the comment : SO_REMAINED -> PACK_REMAINED
|
||||
//! 2. Add the comment as zero byte udp data reception in getsockopt().
|
||||
//! <2013/10/21> 1st Release
|
||||
//! \author MidnightCow
|
||||
//! \copyright
|
||||
//!
|
||||
//! Copyright (c) 2013, WIZnet Co., LTD.
|
||||
//! All rights reserved.
|
||||
//!
|
||||
//! Redistribution and use in source and binary forms, with or without
|
||||
//! modification, are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * Redistributions of source code must retain the above copyright
|
||||
//! notice, this list of conditions and the following disclaimer.
|
||||
//! * 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.
|
||||
//! * Neither the name of the <ORGANIZATION> nor the names of its
|
||||
//! contributors may be used to endorse or promote products derived
|
||||
//! from this software without specific prior written permission.
|
||||
//!
|
||||
//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
|
||||
//
|
||||
//*****************************************************************************
|
||||
/**
|
||||
* @defgroup WIZnet_socket_APIs 1. WIZnet socket APIs
|
||||
* @brief WIZnet socket APIs are based on Berkeley socket APIs, thus it has much similar name and interface.
|
||||
* But there is a little bit of difference.
|
||||
* @details
|
||||
* <b> Comparison between WIZnet and Berkeley SOCKET APIs </b>
|
||||
* <table>
|
||||
* <tr> <td><b>API</b></td> <td><b>WIZnet</b></td> <td><b>Berkeley</b></td> </tr>
|
||||
* <tr> <td>socket()</td> <td>O</td> <td>O</td> </tr>
|
||||
* <tr> <td><b>bind()</b></td> <td>X</td> <td>O</td> </tr>
|
||||
* <tr> <td><b>listen()</b></td> <td>O</td> <td>O</td> </tr>
|
||||
* <tr> <td><b>connect()</b></td> <td>O</td> <td>O</td> </tr>
|
||||
* <tr> <td><b>accept()</b></td> <td>X</td> <td>O</td> </tr>
|
||||
* <tr> <td><b>recv()</b></td> <td>O</td> <td>O</td> </tr>
|
||||
* <tr> <td><b>send()</b></td> <td>O</td> <td>O</td> </tr>
|
||||
* <tr> <td><b>recvfrom()</b></td> <td>O</td> <td>O</td> </tr>
|
||||
* <tr> <td><b>sendto()</b></td> <td>O</td> <td>O</td> </tr>
|
||||
* <tr> <td><b>closesocket()</b></td> <td>O<br>close() & disconnect()</td> <td>O</td> </tr>
|
||||
* </table>
|
||||
* There are @b bind() and @b accept() functions in @b Berkeley SOCKET API but,
|
||||
* not in @b WIZnet SOCKET API. Because socket() of WIZnet is not only creating a SOCKET but also binding a local port number,
|
||||
* and listen() of WIZnet is not only listening to connection request from client but also accepting the connection request. \n
|
||||
* When you program "TCP SERVER" with Berkeley SOCKET API, you can use only one listen port.
|
||||
* When the listen SOCKET accepts a connection request from a client, it keeps listening.
|
||||
* After accepting the connection request, a new SOCKET is created and the new SOCKET is used in communication with the client. \n
|
||||
* Following figure shows network flow diagram by Berkeley SOCKET API.
|
||||
* @image html Berkeley_SOCKET.jpg "<Berkeley SOCKET API>"
|
||||
* But, When you program "TCP SERVER" with WIZnet SOCKET API, you can use as many as 8 listen SOCKET with same port number. \n
|
||||
* Because there's no accept() in WIZnet SOCKET APIs, when the listen SOCKET accepts a connection request from a client,
|
||||
* it is changed in order to communicate with the client.
|
||||
* And the changed SOCKET is not listening any more and is dedicated for communicating with the client. \n
|
||||
* If there're many listen SOCKET with same listen port number and a client requests a connection,
|
||||
* the SOCKET which has the smallest SOCKET number accepts the request and is changed as communication SOCKET. \n
|
||||
* Following figure shows network flow diagram by WIZnet SOCKET API.
|
||||
* @image html WIZnet_SOCKET.jpg "<WIZnet SOCKET API>"
|
||||
*/
|
||||
#ifndef _WIZCHIP_SOCKET_H_
|
||||
#define _WIZCHIP_SOCKET_H_
|
||||
|
||||
// use this macro for exported names to avoid name clashes
|
||||
#define WIZCHIP_EXPORT(name) wizchip_ ## name
|
||||
|
||||
#include "wizchip_conf.h"
|
||||
|
||||
#define SOCKET uint8_t ///< SOCKET type define for legacy driver
|
||||
|
||||
#define SOCK_OK 1 ///< Result is OK about socket process.
|
||||
#define SOCK_BUSY 0 ///< Socket is busy on processing the operation. Valid only Non-block IO Mode.
|
||||
#define SOCK_FATAL -1000 ///< Result is fatal error about socket process.
|
||||
|
||||
#define SOCK_ERROR 0
|
||||
#define SOCKERR_SOCKNUM (SOCK_ERROR - 1) ///< Invalid socket number
|
||||
#define SOCKERR_SOCKOPT (SOCK_ERROR - 2) ///< Invalid socket option
|
||||
#define SOCKERR_SOCKINIT (SOCK_ERROR - 3) ///< Socket is not initialized
|
||||
#define SOCKERR_SOCKCLOSED (SOCK_ERROR - 4) ///< Socket unexpectedly closed.
|
||||
#define SOCKERR_SOCKMODE (SOCK_ERROR - 5) ///< Invalid socket mode for socket operation.
|
||||
#define SOCKERR_SOCKFLAG (SOCK_ERROR - 6) ///< Invalid socket flag
|
||||
#define SOCKERR_SOCKSTATUS (SOCK_ERROR - 7) ///< Invalid socket status for socket operation.
|
||||
#define SOCKERR_ARG (SOCK_ERROR - 10) ///< Invalid argument.
|
||||
#define SOCKERR_PORTZERO (SOCK_ERROR - 11) ///< Port number is zero
|
||||
#define SOCKERR_IPINVALID (SOCK_ERROR - 12) ///< Invalid IP address
|
||||
#define SOCKERR_TIMEOUT (SOCK_ERROR - 13) ///< Timeout occurred
|
||||
#define SOCKERR_DATALEN (SOCK_ERROR - 14) ///< Data length is zero or greater than buffer max size.
|
||||
#define SOCKERR_BUFFER (SOCK_ERROR - 15) ///< Socket buffer is not enough for data communication.
|
||||
|
||||
#define SOCKFATAL_PACKLEN (SOCK_FATAL - 1) ///< Invalid packet length. Fatal Error.
|
||||
|
||||
/*
|
||||
* SOCKET FLAG
|
||||
*/
|
||||
#define SF_ETHER_OWN (Sn_MR_MFEN) ///< In \ref Sn_MR_MACRAW, Receive only the packet as broadcast, multicast and own packet
|
||||
#define SF_IGMP_VER2 (Sn_MR_MC) ///< In \ref Sn_MR_UDP with \ref SF_MULTI_ENABLE, Select IGMP version 2.
|
||||
#define SF_TCP_NODELAY (Sn_MR_ND) ///< In \ref Sn_MR_TCP, Use to nodelayed ack.
|
||||
#define SF_MULTI_ENABLE (Sn_MR_MULTI) ///< In \ref Sn_MR_UDP, Enable multicast mode.
|
||||
|
||||
#if _WIZCHIP_ == 5500
|
||||
#define SF_BROAD_BLOCK (Sn_MR_BCASTB) ///< In \ref Sn_MR_UDP or \ref Sn_MR_MACRAW, Block broadcast packet. Valid only in W5500
|
||||
#define SF_MULTI_BLOCK (Sn_MR_MMB) ///< In \ref Sn_MR_MACRAW, Block multicast packet. Valid only in W5500
|
||||
#define SF_IPv6_BLOCK (Sn_MR_MIP6B) ///< In \ref Sn_MR_MACRAW, Block IPv6 packet. Valid only in W5500
|
||||
#define SF_UNI_BLOCK (Sn_MR_UCASTB) ///< In \ref Sn_MR_UDP with \ref SF_MULTI_ENABLE. Valid only in W5500
|
||||
#endif
|
||||
|
||||
#define SF_IO_NONBLOCK 0x01 ///< Socket nonblock io mode. It used parameter in \ref socket().
|
||||
|
||||
/*
|
||||
* UDP & MACRAW Packet Infomation
|
||||
*/
|
||||
#define PACK_FIRST 0x80 ///< In Non-TCP packet, It indicates to start receiving a packet.
|
||||
#define PACK_REMAINED 0x01 ///< In Non-TCP packet, It indicates to remain a packet to be received.
|
||||
#define PACK_COMPLETED 0x00 ///< In Non-TCP packet, It indicates to complete to receive a packet.
|
||||
|
||||
// resets all global state associated with the socket interface
|
||||
void WIZCHIP_EXPORT(socket_reset)(void);
|
||||
|
||||
/**
|
||||
* @ingroup WIZnet_socket_APIs
|
||||
* @brief Open a socket.
|
||||
* @details Initializes the socket with 'sn' passed as parameter and open.
|
||||
*
|
||||
* @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
|
||||
* @param protocol Protocol type to operate such as TCP, UDP and MACRAW.
|
||||
* @param port Port number to be bined.
|
||||
* @param flag Socket flags as \ref SF_ETHER_OWN, \ref SF_IGMP_VER2, \ref SF_TCP_NODELAY, \ref SF_MULTI_ENABLE, \ref SF_IO_NONBLOCK and so on.\n
|
||||
* Valid flags only in W5500 : @ref SF_BROAD_BLOCK, @ref SF_MULTI_BLOCK, @ref SF_IPv6_BLOCK, and @ref SF_UNI_BLOCK.
|
||||
* @sa Sn_MR
|
||||
*
|
||||
* @return @b Success : The socket number @b 'sn' passed as parameter\n
|
||||
* @b Fail :\n @ref SOCKERR_SOCKNUM - Invalid socket number\n
|
||||
* @ref SOCKERR_SOCKMODE - Not support socket mode as TCP, UDP, and so on. \n
|
||||
* @ref SOCKERR_SOCKFLAG - Invaild socket flag.
|
||||
*/
|
||||
int8_t WIZCHIP_EXPORT(socket)(uint8_t sn, uint8_t protocol, uint16_t port, uint8_t flag);
|
||||
|
||||
/**
|
||||
* @ingroup WIZnet_socket_APIs
|
||||
* @brief Close a socket.
|
||||
* @details It closes the socket with @b'sn' passed as parameter.
|
||||
*
|
||||
* @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
|
||||
*
|
||||
* @return @b Success : @ref SOCK_OK \n
|
||||
* @b Fail : @ref SOCKERR_SOCKNUM - Invalid socket number
|
||||
*/
|
||||
int8_t WIZCHIP_EXPORT(close)(uint8_t sn);
|
||||
|
||||
/**
|
||||
* @ingroup WIZnet_socket_APIs
|
||||
* @brief Listen to a connection request from a client.
|
||||
* @details It is listening to a connection request from a client.
|
||||
* If connection request is accepted successfully, the connection is established. Socket sn is used in passive(server) mode.
|
||||
*
|
||||
* @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
|
||||
* @return @b Success : @ref SOCK_OK \n
|
||||
* @b Fail :\n @ref SOCKERR_SOCKINIT - Socket is not initialized \n
|
||||
* @ref SOCKERR_SOCKCLOSED - Socket closed unexpectedly.
|
||||
*/
|
||||
int8_t WIZCHIP_EXPORT(listen)(uint8_t sn);
|
||||
|
||||
/**
|
||||
* @ingroup WIZnet_socket_APIs
|
||||
* @brief Try to connect a server.
|
||||
* @details It requests connection to the server with destination IP address and port number passed as parameter.\n
|
||||
* @note It is valid only in TCP client mode.
|
||||
* In block io mode, it does not return until connection is completed.
|
||||
* In Non-block io mode, it return @ref SOCK_BUSY immediately.
|
||||
*
|
||||
* @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
|
||||
* @param addr Pointer variable of destination IP address. It should be allocated 4 bytes.
|
||||
* @param port Destination port number.
|
||||
*
|
||||
* @return @b Success : @ref SOCK_OK \n
|
||||
* @b Fail :\n @ref SOCKERR_SOCKNUM - Invalid socket number\n
|
||||
* @ref SOCKERR_SOCKMODE - Invalid socket mode\n
|
||||
* @ref SOCKERR_SOCKINIT - Socket is not initialized\n
|
||||
* @ref SOCKERR_IPINVALID - Wrong server IP address\n
|
||||
* @ref SOCKERR_PORTZERO - Server port zero\n
|
||||
* @ref SOCKERR_TIMEOUT - Timeout occurred during request connection\n
|
||||
* @ref SOCK_BUSY - In non-block io mode, it returned immediately\n
|
||||
*/
|
||||
int8_t WIZCHIP_EXPORT(connect)(uint8_t sn, uint8_t * addr, uint16_t port);
|
||||
|
||||
/**
|
||||
* @ingroup WIZnet_socket_APIs
|
||||
* @brief Try to disconnect a connection socket.
|
||||
* @details It sends request message to disconnect the TCP socket 'sn' passed as parameter to the server or client.
|
||||
* @note It is valid only in TCP server or client mode. \n
|
||||
* In block io mode, it does not return until disconnection is completed. \n
|
||||
* In Non-block io mode, it return @ref SOCK_BUSY immediately. \n
|
||||
|
||||
* @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
|
||||
* @return @b Success : @ref SOCK_OK \n
|
||||
* @b Fail :\n @ref SOCKERR_SOCKNUM - Invalid socket number \n
|
||||
* @ref SOCKERR_SOCKMODE - Invalid operation in the socket \n
|
||||
* @ref SOCKERR_TIMEOUT - Timeout occurred \n
|
||||
* @ref SOCK_BUSY - Socket is busy.
|
||||
*/
|
||||
int8_t WIZCHIP_EXPORT(disconnect)(uint8_t sn);
|
||||
|
||||
/**
|
||||
* @ingroup WIZnet_socket_APIs
|
||||
* @brief Send data to the connected peer in TCP socket.
|
||||
* @details It is used to send outgoing data to the connected socket.
|
||||
* @note It is valid only in TCP server or client mode. It can't send data greater than socket buffer size. \n
|
||||
* In block io mode, It doesn't return until data send is completed - socket buffer size is greater than data. \n
|
||||
* In non-block io mode, It return @ref SOCK_BUSY immediately when socket buffer is not enough. \n
|
||||
* @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
|
||||
* @param buf Pointer buffer containing data to be sent.
|
||||
* @param len The byte length of data in buf.
|
||||
* @return @b Success : The sent data size \n
|
||||
* @b Fail : \n @ref SOCKERR_SOCKSTATUS - Invalid socket status for socket operation \n
|
||||
* @ref SOCKERR_TIMEOUT - Timeout occurred \n
|
||||
* @ref SOCKERR_SOCKMODE - Invalid operation in the socket \n
|
||||
* @ref SOCKERR_SOCKNUM - Invalid socket number \n
|
||||
* @ref SOCKERR_DATALEN - zero data length \n
|
||||
* @ref SOCK_BUSY - Socket is busy.
|
||||
*/
|
||||
int32_t WIZCHIP_EXPORT(send)(uint8_t sn, uint8_t * buf, uint16_t len);
|
||||
|
||||
/**
|
||||
* @ingroup WIZnet_socket_APIs
|
||||
* @brief Receive data from the connected peer.
|
||||
* @details It is used to read incoming data from the connected socket.\n
|
||||
* It waits for data as much as the application wants to receive.
|
||||
* @note It is valid only in TCP server or client mode. It can't receive data greater than socket buffer size. \n
|
||||
* In block io mode, it doesn't return until data reception is completed - data is filled as <I>len</I> in socket buffer. \n
|
||||
* In non-block io mode, it return @ref SOCK_BUSY immediately when <I>len</I> is greater than data size in socket buffer. \n
|
||||
*
|
||||
* @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
|
||||
* @param buf Pointer buffer to read incoming data.
|
||||
* @param len The max data length of data in buf.
|
||||
* @return @b Success : The real received data size \n
|
||||
* @b Fail :\n
|
||||
* @ref SOCKERR_SOCKSTATUS - Invalid socket status for socket operation \n
|
||||
* @ref SOCKERR_SOCKMODE - Invalid operation in the socket \n
|
||||
* @ref SOCKERR_SOCKNUM - Invalid socket number \n
|
||||
* @ref SOCKERR_DATALEN - zero data length \n
|
||||
* @ref SOCK_BUSY - Socket is busy.
|
||||
*/
|
||||
int32_t WIZCHIP_EXPORT(recv)(uint8_t sn, uint8_t * buf, uint16_t len);
|
||||
|
||||
/**
|
||||
* @ingroup WIZnet_socket_APIs
|
||||
* @brief Sends datagram to the peer with destination IP address and port number passed as parameter.
|
||||
* @details It sends datagram of UDP or MACRAW to the peer with destination IP address and port number passed as parameter.\n
|
||||
* Even if the connectionless socket has been previously connected to a specific address,
|
||||
* the address and port number parameters override the destination address for that particular datagram only.
|
||||
* @note In block io mode, It doesn't return until data send is completed - socket buffer size is greater than <I>len</I>.
|
||||
* In non-block io mode, It return @ref SOCK_BUSY immediately when socket buffer is not enough.
|
||||
*
|
||||
* @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
|
||||
* @param buf Pointer buffer to send outgoing data.
|
||||
* @param len The byte length of data in buf.
|
||||
* @param addr Pointer variable of destination IP address. It should be allocated 4 bytes.
|
||||
* @param port Destination port number.
|
||||
*
|
||||
* @return @b Success : The sent data size \n
|
||||
* @b Fail :\n @ref SOCKERR_SOCKNUM - Invalid socket number \n
|
||||
* @ref SOCKERR_SOCKMODE - Invalid operation in the socket \n
|
||||
* @ref SOCKERR_SOCKSTATUS - Invalid socket status for socket operation \n
|
||||
* @ref SOCKERR_DATALEN - zero data length \n
|
||||
* @ref SOCKERR_IPINVALID - Wrong server IP address\n
|
||||
* @ref SOCKERR_PORTZERO - Server port zero\n
|
||||
* @ref SOCKERR_SOCKCLOSED - Socket unexpectedly closed \n
|
||||
* @ref SOCKERR_TIMEOUT - Timeout occurred \n
|
||||
* @ref SOCK_BUSY - Socket is busy.
|
||||
*/
|
||||
int32_t WIZCHIP_EXPORT(sendto)(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port);
|
||||
|
||||
/**
|
||||
* @ingroup WIZnet_socket_APIs
|
||||
* @brief Receive datagram of UDP or MACRAW
|
||||
* @details This function is an application I/F function which is used to receive the data in other then TCP mode. \n
|
||||
* This function is used to receive UDP and MAC_RAW mode, and handle the header as well.
|
||||
* This function can divide to received the packet data.
|
||||
* On the MACRAW SOCKET, the addr and port parameters are ignored.
|
||||
* @note In block io mode, it doesn't return until data reception is completed - data is filled as <I>len</I> in socket buffer
|
||||
* In non-block io mode, it return @ref SOCK_BUSY immediately when <I>len</I> is greater than data size in socket buffer.
|
||||
*
|
||||
* @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
|
||||
* @param buf Pointer buffer to read incoming data.
|
||||
* @param len The max data length of data in buf.
|
||||
* When the received packet size <= len, receives data as packet sized.
|
||||
* When others, receives data as len.
|
||||
* @param addr Pointer variable of destination IP address. It should be allocated 4 bytes.
|
||||
* It is valid only when the first call recvfrom for receiving the packet.
|
||||
* When it is valid, @ref packinfo[7] should be set as '1' after call @ref getsockopt(sn, SO_PACKINFO, &packinfo).
|
||||
* @param port Pointer variable of destination port number.
|
||||
* It is valid only when the first call recvform for receiving the packet.
|
||||
* When it is valid, @ref packinfo[7] should be set as '1' after call @ref getsockopt(sn, SO_PACKINFO, &packinfo).
|
||||
*
|
||||
* @return @b Success : This function return real received data size for success.\n
|
||||
* @b Fail : @ref SOCKERR_DATALEN - zero data length \n
|
||||
* @ref SOCKERR_SOCKMODE - Invalid operation in the socket \n
|
||||
* @ref SOCKERR_SOCKNUM - Invalid socket number \n
|
||||
* @ref SOCKBUSY - Socket is busy.
|
||||
*/
|
||||
int32_t WIZCHIP_EXPORT(recvfrom)(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t *port);
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
// SOCKET CONTROL & OPTION //
|
||||
/////////////////////////////
|
||||
#define SOCK_IO_BLOCK 0 ///< Socket Block IO Mode in @ref setsockopt().
|
||||
#define SOCK_IO_NONBLOCK 1 ///< Socket Non-block IO Mode in @ref setsockopt().
|
||||
|
||||
/**
|
||||
* @defgroup DATA_TYPE DATA TYPE
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup DATA_TYPE
|
||||
* @brief The kind of Socket Interrupt.
|
||||
* @sa Sn_IR, Sn_IMR, setSn_IR(), getSn_IR(), setSn_IMR(), getSn_IMR()
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SIK_CONNECTED = (1 << 0), ///< connected
|
||||
SIK_DISCONNECTED = (1 << 1), ///< disconnected
|
||||
SIK_RECEIVED = (1 << 2), ///< data received
|
||||
SIK_TIMEOUT = (1 << 3), ///< timeout occurred
|
||||
SIK_SENT = (1 << 4), ///< send ok
|
||||
SIK_ALL = 0x1F, ///< all interrupt
|
||||
}sockint_kind;
|
||||
|
||||
/**
|
||||
* @ingroup DATA_TYPE
|
||||
* @brief The type of @ref ctlsocket().
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CS_SET_IOMODE, ///< set socket IO mode with @ref SOCK_IO_BLOCK or @ref SOCK_IO_NONBLOCK
|
||||
CS_GET_IOMODE, ///< get socket IO mode
|
||||
CS_GET_MAXTXBUF, ///< get the size of socket buffer allocated in TX memory
|
||||
CS_GET_MAXRXBUF, ///< get the size of socket buffer allocated in RX memory
|
||||
CS_CLR_INTERRUPT, ///< clear the interrupt of socket with @ref sockint_kind
|
||||
CS_GET_INTERRUPT, ///< get the socket interrupt. refer to @ref sockint_kind
|
||||
CS_SET_INTMASK, ///< set the interrupt mask of socket with @ref sockint_kind
|
||||
CS_GET_INTMASK ///< get the masked interrupt of socket. refer to @ref sockint_kind
|
||||
}ctlsock_type;
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup DATA_TYPE
|
||||
* @brief The type of socket option in @ref setsockopt() or @ref getsockopt()
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SO_FLAG, ///< Valid only in getsockopt(), For set flag of socket refer to <I>flag</I> in @ref socket().
|
||||
SO_TTL, ///< Set/Get TTL. @ref Sn_TTL ( @ref setSn_TTL(), @ref getSn_TTL() )
|
||||
SO_TOS, ///< Set/Get TOS. @ref Sn_TOS ( @ref setSn_TOS(), @ref getSn_TOS() )
|
||||
SO_MSS, ///< Set/Get MSS. @ref Sn_MSSR ( @ref setSn_MSSR(), @ref getSn_MSSR() )
|
||||
SO_DESTIP, ///< Set/Get the destination IP address. @ref Sn_DIPR ( @ref setSn_DIPR(), @ref getSn_DIPR() )
|
||||
SO_DESTPORT, ///< Set/Get the destination Port number. @ref Sn_DPORT ( @ref setSn_DPORT(), @ref getSn_DPORT() )
|
||||
#if _WIZCHIP_ != 5100
|
||||
SO_KEEPALIVESEND, ///< Valid only in setsockopt. Manually send keep-alive packet in TCP mode
|
||||
#if _WIZCHIP_ > 5200
|
||||
SO_KEEPALIVEAUTO, ///< Set/Get keep-alive auto transmission timer in TCP mode
|
||||
#endif
|
||||
#endif
|
||||
SO_SENDBUF, ///< Valid only in getsockopt. Get the free data size of Socekt TX buffer. @ref Sn_TX_FSR, @ref getSn_TX_FSR()
|
||||
SO_RECVBUF, ///< Valid only in getsockopt. Get the received data size in socket RX buffer. @ref Sn_RX_RSR, @ref getSn_RX_RSR()
|
||||
SO_STATUS, ///< Valid only in getsockopt. Get the socket status. @ref Sn_SR, @ref getSn_SR()
|
||||
SO_REMAINSIZE, ///< Valid only in getsockopt. Get the remained packet size in other then TCP mode.
|
||||
SO_PACKINFO ///< Valid only in getsockopt. Get the packet information as @ref PACK_FIRST, @ref PACK_REMAINED, and @ref PACK_COMPLETED in other then TCP mode.
|
||||
}sockopt_type;
|
||||
|
||||
/**
|
||||
* @ingroup WIZnet_socket_APIs
|
||||
* @brief Control socket.
|
||||
* @details Control IO mode, Interrupt & Mask of socket and get the socket buffer information.
|
||||
* Refer to @ref ctlsock_type.
|
||||
* @param sn socket number
|
||||
* @param cstype type of control socket. refer to @ref ctlsock_type.
|
||||
* @param arg Data type and value is determined according to @ref ctlsock_type. \n
|
||||
* <table>
|
||||
* <tr> <td> @b cstype </td> <td> @b data type</td><td>@b value</td></tr>
|
||||
* <tr> <td> @ref CS_SET_IOMODE \n @ref CS_GET_IOMODE </td> <td> uint8_t </td><td>@ref SOCK_IO_BLOCK @ref SOCK_IO_NONBLOCK</td></tr>
|
||||
* <tr> <td> @ref CS_GET_MAXTXBUF \n @ref CS_GET_MAXRXBUF </td> <td> uint16_t </td><td> 0 ~ 16K </td></tr>
|
||||
* <tr> <td> @ref CS_CLR_INTERRUPT \n @ref CS_GET_INTERRUPT \n @ref CS_SET_INTMASK \n @ref CS_GET_INTMASK </td> <td> @ref sockint_kind </td><td> @ref SIK_CONNECTED, etc. </td></tr>
|
||||
* </table>
|
||||
* @return @b Success @ref SOCK_OK \n
|
||||
* @b fail @ref SOCKERR_ARG - Invalid argument\n
|
||||
*/
|
||||
int8_t WIZCHIP_EXPORT(ctlsocket)(uint8_t sn, ctlsock_type cstype, void* arg);
|
||||
|
||||
/**
|
||||
* @ingroup WIZnet_socket_APIs
|
||||
* @brief set socket options
|
||||
* @details Set socket option like as TTL, MSS, TOS, and so on. Refer to @ref sockopt_type.
|
||||
*
|
||||
* @param sn socket number
|
||||
* @param sotype socket option type. refer to @ref sockopt_type
|
||||
* @param arg Data type and value is determined according to <I>sotype</I>. \n
|
||||
* <table>
|
||||
* <tr> <td> @b sotype </td> <td> @b data type</td><td>@b value</td></tr>
|
||||
* <tr> <td> @ref SO_TTL </td> <td> uint8_t </td><td> 0 ~ 255 </td> </tr>
|
||||
* <tr> <td> @ref SO_TOS </td> <td> uint8_t </td><td> 0 ~ 255 </td> </tr>
|
||||
* <tr> <td> @ref SO_MSS </td> <td> uint16_t </td><td> 0 ~ 65535 </td> </tr>
|
||||
* <tr> <td> @ref SO_DESTIP </td> <td> uint8_t[4] </td><td> </td></tr>
|
||||
* <tr> <td> @ref SO_DESTPORT </td> <td> uint16_t </td><td> 0 ~ 65535 </td></tr>
|
||||
* <tr> <td> @ref SO_KEEPALIVESEND </td> <td> null </td><td> null </td></tr>
|
||||
* <tr> <td> @ref SO_KEEPALIVEAUTO </td> <td> uint8_t </td><td> 0 ~ 255 </td></tr>
|
||||
* </table>
|
||||
* @return
|
||||
* - @b Success : @ref SOCK_OK \n
|
||||
* - @b Fail
|
||||
* - @ref SOCKERR_SOCKNUM - Invalid Socket number \n
|
||||
* - @ref SOCKERR_SOCKMODE - Invalid socket mode \n
|
||||
* - @ref SOCKERR_SOCKOPT - Invalid socket option or its value \n
|
||||
* - @ref SOCKERR_TIMEOUT - Timeout occurred when sending keep-alive packet \n
|
||||
*/
|
||||
int8_t WIZCHIP_EXPORT(setsockopt)(uint8_t sn, sockopt_type sotype, void* arg);
|
||||
|
||||
/**
|
||||
* @ingroup WIZnet_socket_APIs
|
||||
* @brief get socket options
|
||||
* @details Get socket option like as FLAG, TTL, MSS, and so on. Refer to @ref sockopt_type
|
||||
* @param sn socket number
|
||||
* @param sotype socket option type. refer to @ref sockopt_type
|
||||
* @param arg Data type and value is determined according to <I>sotype</I>. \n
|
||||
* <table>
|
||||
* <tr> <td> @b sotype </td> <td>@b data type</td><td>@b value</td></tr>
|
||||
* <tr> <td> @ref SO_FLAG </td> <td> uint8_t </td><td> @ref SF_ETHER_OWN, etc... </td> </tr>
|
||||
* <tr> <td> @ref SO_TOS </td> <td> uint8_t </td><td> 0 ~ 255 </td> </tr>
|
||||
* <tr> <td> @ref SO_MSS </td> <td> uint16_t </td><td> 0 ~ 65535 </td> </tr>
|
||||
* <tr> <td> @ref SO_DESTIP </td> <td> uint8_t[4] </td><td> </td></tr>
|
||||
* <tr> <td> @ref SO_DESTPORT </td> <td> uint16_t </td><td> </td></tr>
|
||||
* <tr> <td> @ref SO_KEEPALIVEAUTO </td> <td> uint8_t </td><td> 0 ~ 255 </td></tr>
|
||||
* <tr> <td> @ref SO_SENDBUF </td> <td> uint16_t </td><td> 0 ~ 65535 </td></tr>
|
||||
* <tr> <td> @ref SO_RECVBUF </td> <td> uint16_t </td><td> 0 ~ 65535 </td></tr>
|
||||
* <tr> <td> @ref SO_STATUS </td> <td> uint8_t </td><td> @ref SOCK_ESTABLISHED, etc.. </td></tr>
|
||||
* <tr> <td> @ref SO_REMAINSIZE </td> <td> uint16_t </td><td> 0~ 65535 </td></tr>
|
||||
* <tr> <td> @ref SO_PACKINFO </td> <td> uint8_t </td><td> @ref PACK_FIRST, etc... </td></tr>
|
||||
* </table>
|
||||
* @return
|
||||
* - @b Success : @ref SOCK_OK \n
|
||||
* - @b Fail
|
||||
* - @ref SOCKERR_SOCKNUM - Invalid Socket number \n
|
||||
* - @ref SOCKERR_SOCKOPT - Invalid socket option or its value \n
|
||||
* - @ref SOCKERR_SOCKMODE - Invalid socket mode \n
|
||||
* @note
|
||||
* The option as PACK_REMAINED and SO_PACKINFO is valid only in NON-TCP mode and after call @ref recvfrom(). \n
|
||||
* When SO_PACKINFO value is PACK_FIRST and the return value of recvfrom() is zero,
|
||||
* This means the zero byte UDP data(UDP Header only) received.
|
||||
*/
|
||||
int8_t WIZCHIP_EXPORT(getsockopt)(uint8_t sn, sockopt_type sotype, void* arg);
|
||||
|
||||
#endif // _WIZCHIP_SOCKET_H_
|
206
drivers/wiznet5k/ethernet/w5200/w5200.c
Normal file
206
drivers/wiznet5k/ethernet/w5200/w5200.c
Normal file
@ -0,0 +1,206 @@
|
||||
// dpgeorge: this file taken from w5500/w5500.c and adapted to W5200
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \file w5500.c
|
||||
//! \brief W5500 HAL Interface.
|
||||
//! \version 1.0.1
|
||||
//! \date 2013/10/21
|
||||
//! \par Revision history
|
||||
//! <2014/05/01> V1.0.2
|
||||
//! 1. Implicit type casting -> Explicit type casting. Refer to M20140501
|
||||
//! Fixed the problem on porting into under 32bit MCU
|
||||
//! Issued by Mathias ClauBen, wizwiki forum ID Think01 and bobh
|
||||
//! Thank for your interesting and serious advices.
|
||||
//! <2013/10/21> 1st Release
|
||||
//! <2013/12/20> V1.0.1
|
||||
//! 1. Remove warning
|
||||
//! 2. WIZCHIP_READ_BUF WIZCHIP_WRITE_BUF in case _WIZCHIP_IO_MODE_SPI_FDM_
|
||||
//! for loop optimized(removed). refer to M20131220
|
||||
//! \author MidnightCow
|
||||
//! \copyright
|
||||
//!
|
||||
//! Copyright (c) 2013, WIZnet Co., LTD.
|
||||
//! All rights reserved.
|
||||
//!
|
||||
//! Redistribution and use in source and binary forms, with or without
|
||||
//! modification, are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * Redistributions of source code must retain the above copyright
|
||||
//! notice, this list of conditions and the following disclaimer.
|
||||
//! * 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.
|
||||
//! * Neither the name of the <ORGANIZATION> nor the names of its
|
||||
//! contributors may be used to endorse or promote products derived
|
||||
//! from this software without specific prior written permission.
|
||||
//!
|
||||
//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 "w5200.h"
|
||||
|
||||
#define SMASK (0x7ff) /* tx buffer mask */
|
||||
#define RMASK (0x7ff) /* rx buffer mask */
|
||||
#define SSIZE (2048) /* max tx buffer size */
|
||||
#define RSIZE (2048) /* max rx buffer size */
|
||||
|
||||
#define TXBUF_BASE (0x8000)
|
||||
#define RXBUF_BASE (0xc000)
|
||||
#define SBASE(sn) (TXBUF_BASE + SSIZE * (sn)) /* tx buffer base for socket sn */
|
||||
#define RBASE(sn) (RXBUF_BASE + RSIZE * (sn)) /* rx buffer base for socket sn */
|
||||
|
||||
uint8_t WIZCHIP_READ(uint32_t AddrSel) {
|
||||
WIZCHIP_CRITICAL_ENTER();
|
||||
WIZCHIP.CS._select();
|
||||
|
||||
uint8_t spi_data[4] = {
|
||||
AddrSel >> 8,
|
||||
AddrSel,
|
||||
0x00,
|
||||
0x01,
|
||||
};
|
||||
WIZCHIP.IF.SPI._write_bytes(spi_data, 4);
|
||||
uint8_t ret;
|
||||
WIZCHIP.IF.SPI._read_bytes(&ret, 1);
|
||||
|
||||
WIZCHIP.CS._deselect();
|
||||
WIZCHIP_CRITICAL_EXIT();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void WIZCHIP_WRITE(uint32_t AddrSel, uint8_t wb) {
|
||||
WIZCHIP_CRITICAL_ENTER();
|
||||
WIZCHIP.CS._select();
|
||||
|
||||
uint8_t spi_data[5] = {
|
||||
AddrSel >> 8,
|
||||
AddrSel,
|
||||
0x80,
|
||||
0x01,
|
||||
wb,
|
||||
};
|
||||
WIZCHIP.IF.SPI._write_bytes(spi_data, 5);
|
||||
|
||||
WIZCHIP.CS._deselect();
|
||||
WIZCHIP_CRITICAL_EXIT();
|
||||
}
|
||||
|
||||
void WIZCHIP_READ_BUF(uint32_t AddrSel, uint8_t* pBuf, uint16_t len) {
|
||||
WIZCHIP_CRITICAL_ENTER();
|
||||
WIZCHIP.CS._select();
|
||||
|
||||
uint8_t spi_data[4] = {
|
||||
AddrSel >> 8,
|
||||
AddrSel,
|
||||
0x00 | ((len >> 8) & 0x7f),
|
||||
len & 0xff,
|
||||
};
|
||||
WIZCHIP.IF.SPI._write_bytes(spi_data, 4);
|
||||
WIZCHIP.IF.SPI._read_bytes(pBuf, len);
|
||||
|
||||
WIZCHIP.CS._deselect();
|
||||
WIZCHIP_CRITICAL_EXIT();
|
||||
}
|
||||
|
||||
void WIZCHIP_WRITE_BUF(uint32_t AddrSel, uint8_t* pBuf, uint16_t len) {
|
||||
WIZCHIP_CRITICAL_ENTER();
|
||||
WIZCHIP.CS._select();
|
||||
|
||||
uint8_t spi_data[4] = {
|
||||
AddrSel >> 8,
|
||||
AddrSel,
|
||||
0x80 | ((len >> 8) & 0x7f),
|
||||
len & 0xff,
|
||||
};
|
||||
WIZCHIP.IF.SPI._write_bytes(spi_data, 4);
|
||||
WIZCHIP.IF.SPI._write_bytes(pBuf, len);
|
||||
|
||||
WIZCHIP.CS._deselect();
|
||||
WIZCHIP_CRITICAL_EXIT();
|
||||
}
|
||||
|
||||
uint16_t getSn_TX_FSR(uint8_t sn) {
|
||||
uint16_t val = 0, val1 = 0;
|
||||
do {
|
||||
val1 = (WIZCHIP_READ(Sn_TX_FSR(sn)) << 8) | WIZCHIP_READ(Sn_TX_FSR(sn) + 1);
|
||||
if (val1 != 0) {
|
||||
val = (WIZCHIP_READ(Sn_TX_FSR(sn)) << 8) | WIZCHIP_READ(Sn_TX_FSR(sn) + 1);
|
||||
}
|
||||
} while (val != val1);
|
||||
return val;
|
||||
}
|
||||
|
||||
uint16_t getSn_RX_RSR(uint8_t sn) {
|
||||
uint16_t val = 0, val1 = 0;
|
||||
do {
|
||||
val1 = (WIZCHIP_READ(Sn_RX_RSR(sn)) << 8) | WIZCHIP_READ(Sn_RX_RSR(sn) + 1);
|
||||
if (val1 != 0) {
|
||||
val = (WIZCHIP_READ(Sn_RX_RSR(sn)) << 8) | WIZCHIP_READ(Sn_RX_RSR(sn) + 1);
|
||||
}
|
||||
} while (val != val1);
|
||||
return val;
|
||||
}
|
||||
|
||||
void wiz_send_data(uint8_t sn, uint8_t *wizdata, uint16_t len) {
|
||||
if (len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t ptr = getSn_TX_WR(sn);
|
||||
uint16_t offset = ptr & SMASK;
|
||||
uint32_t addr = offset + SBASE(sn);
|
||||
|
||||
if (offset + len > SSIZE) {
|
||||
// implement wrap-around circular buffer
|
||||
uint16_t size = SSIZE - offset;
|
||||
WIZCHIP_WRITE_BUF(addr, wizdata, size);
|
||||
WIZCHIP_WRITE_BUF(SBASE(sn), wizdata + size, len - size);
|
||||
} else {
|
||||
WIZCHIP_WRITE_BUF(addr, wizdata, len);
|
||||
}
|
||||
|
||||
ptr += len;
|
||||
setSn_TX_WR(sn, ptr);
|
||||
}
|
||||
|
||||
void wiz_recv_data(uint8_t sn, uint8_t *wizdata, uint16_t len) {
|
||||
if (len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t ptr = getSn_RX_RD(sn);
|
||||
uint16_t offset = ptr & RMASK;
|
||||
uint16_t addr = RBASE(sn) + offset;
|
||||
|
||||
if (offset + len > RSIZE) {
|
||||
// implement wrap-around circular buffer
|
||||
uint16_t size = RSIZE - offset;
|
||||
WIZCHIP_READ_BUF(addr, wizdata, size);
|
||||
WIZCHIP_READ_BUF(RBASE(sn), wizdata + size, len - size);
|
||||
} else {
|
||||
WIZCHIP_READ_BUF(addr, wizdata, len);
|
||||
}
|
||||
|
||||
ptr += len;
|
||||
setSn_RX_RD(sn, ptr);
|
||||
}
|
||||
|
||||
void wiz_recv_ignore(uint8_t sn, uint16_t len) {
|
||||
uint16_t ptr = getSn_RX_RD(sn);
|
||||
ptr += len;
|
||||
setSn_RX_RD(sn, ptr);
|
||||
}
|
2092
drivers/wiznet5k/ethernet/w5200/w5200.h
Normal file
2092
drivers/wiznet5k/ethernet/w5200/w5200.h
Normal file
File diff suppressed because it is too large
Load Diff
247
drivers/wiznet5k/ethernet/w5500/w5500.c
Normal file
247
drivers/wiznet5k/ethernet/w5500/w5500.c
Normal file
@ -0,0 +1,247 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \file w5500.c
|
||||
//! \brief W5500 HAL Interface.
|
||||
//! \version 1.0.1
|
||||
//! \date 2013/10/21
|
||||
//! \par Revision history
|
||||
//! <2014/05/01> V1.0.2
|
||||
//! 1. Implicit type casting -> Explicit type casting. Refer to M20140501
|
||||
//! Fixed the problem on porting into under 32bit MCU
|
||||
//! Issued by Mathias ClauBen, wizwiki forum ID Think01 and bobh
|
||||
//! Thank for your interesting and serious advices.
|
||||
//! <2013/10/21> 1st Release
|
||||
//! <2013/12/20> V1.0.1
|
||||
//! 1. Remove warning
|
||||
//! 2. WIZCHIP_READ_BUF WIZCHIP_WRITE_BUF in case _WIZCHIP_IO_MODE_SPI_FDM_
|
||||
//! for loop optimized(removed). refer to M20131220
|
||||
//! \author MidnightCow
|
||||
//! \copyright
|
||||
//!
|
||||
//! Copyright (c) 2013, WIZnet Co., LTD.
|
||||
//! All rights reserved.
|
||||
//!
|
||||
//! Redistribution and use in source and binary forms, with or without
|
||||
//! modification, are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * Redistributions of source code must retain the above copyright
|
||||
//! notice, this list of conditions and the following disclaimer.
|
||||
//! * 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.
|
||||
//! * Neither the name of the <ORGANIZATION> nor the names of its
|
||||
//! contributors may be used to endorse or promote products derived
|
||||
//! from this software without specific prior written permission.
|
||||
//!
|
||||
//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 <stdio.h>
|
||||
#include "w5500.h"
|
||||
|
||||
#define _W5500_SPI_VDM_OP_ 0x00
|
||||
#define _W5500_SPI_FDM_OP_LEN1_ 0x01
|
||||
#define _W5500_SPI_FDM_OP_LEN2_ 0x02
|
||||
#define _W5500_SPI_FDM_OP_LEN4_ 0x03
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
#define LPC_SSP0 (0)
|
||||
|
||||
static void Chip_SSP_ReadFrames_Blocking(int dummy, uint8_t *buf, uint32_t len) {
|
||||
WIZCHIP.IF.SPI._read_bytes(buf, len);
|
||||
}
|
||||
|
||||
static void Chip_SSP_WriteFrames_Blocking(int dummy, const uint8_t *buf, uint32_t len) {
|
||||
WIZCHIP.IF.SPI._write_bytes(buf, len);
|
||||
}
|
||||
|
||||
uint8_t WIZCHIP_READ(uint32_t AddrSel)
|
||||
{
|
||||
uint8_t ret;
|
||||
uint8_t spi_data[3];
|
||||
|
||||
WIZCHIP_CRITICAL_ENTER();
|
||||
WIZCHIP.CS._select();
|
||||
|
||||
AddrSel |= (_W5500_SPI_READ_ | _W5500_SPI_VDM_OP_);
|
||||
|
||||
//WIZCHIP.IF.SPI._write_byte((AddrSel & 0x00FF0000) >> 16);
|
||||
//WIZCHIP.IF.SPI._write_byte((AddrSel & 0x0000FF00) >> 8);
|
||||
//WIZCHIP.IF.SPI._write_byte((AddrSel & 0x000000FF) >> 0);
|
||||
//ret = WIZCHIP.IF.SPI._read_byte();
|
||||
spi_data[0] = (AddrSel & 0x00FF0000) >> 16;
|
||||
spi_data[1] = (AddrSel & 0x0000FF00) >> 8;
|
||||
spi_data[2] = (AddrSel & 0x000000FF) >> 0;
|
||||
Chip_SSP_WriteFrames_Blocking(LPC_SSP0, spi_data, 3);
|
||||
Chip_SSP_ReadFrames_Blocking(LPC_SSP0, &ret, 1);
|
||||
|
||||
WIZCHIP.CS._deselect();
|
||||
WIZCHIP_CRITICAL_EXIT();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void WIZCHIP_WRITE(uint32_t AddrSel, uint8_t wb )
|
||||
{
|
||||
uint8_t spi_data[4];
|
||||
|
||||
WIZCHIP_CRITICAL_ENTER();
|
||||
WIZCHIP.CS._select();
|
||||
|
||||
AddrSel |= (_W5500_SPI_WRITE_ | _W5500_SPI_VDM_OP_);
|
||||
|
||||
//WIZCHIP.IF.SPI._write_byte((AddrSel & 0x00FF0000) >> 16);
|
||||
//WIZCHIP.IF.SPI._write_byte((AddrSel & 0x0000FF00) >> 8);
|
||||
//WIZCHIP.IF.SPI._write_byte((AddrSel & 0x000000FF) >> 0);
|
||||
//WIZCHIP.IF.SPI._write_byte(wb);
|
||||
spi_data[0] = (AddrSel & 0x00FF0000) >> 16;
|
||||
spi_data[1] = (AddrSel & 0x0000FF00) >> 8;
|
||||
spi_data[2] = (AddrSel & 0x000000FF) >> 0;
|
||||
spi_data[3] = wb;
|
||||
Chip_SSP_WriteFrames_Blocking(LPC_SSP0, spi_data, 4);
|
||||
|
||||
WIZCHIP.CS._deselect();
|
||||
WIZCHIP_CRITICAL_EXIT();
|
||||
}
|
||||
|
||||
void WIZCHIP_READ_BUF (uint32_t AddrSel, uint8_t* pBuf, uint16_t len)
|
||||
{
|
||||
uint8_t spi_data[3];
|
||||
//uint16_t i;
|
||||
|
||||
WIZCHIP_CRITICAL_ENTER();
|
||||
WIZCHIP.CS._select();
|
||||
|
||||
AddrSel |= (_W5500_SPI_READ_ | _W5500_SPI_VDM_OP_);
|
||||
|
||||
//WIZCHIP.IF.SPI._write_byte((AddrSel & 0x00FF0000) >> 16);
|
||||
//WIZCHIP.IF.SPI._write_byte((AddrSel & 0x0000FF00) >> 8);
|
||||
//WIZCHIP.IF.SPI._write_byte((AddrSel & 0x000000FF) >> 0);
|
||||
//for(i = 0; i < len; i++)
|
||||
// pBuf[i] = WIZCHIP.IF.SPI._read_byte();
|
||||
spi_data[0] = (AddrSel & 0x00FF0000) >> 16;
|
||||
spi_data[1] = (AddrSel & 0x0000FF00) >> 8;
|
||||
spi_data[2] = (AddrSel & 0x000000FF) >> 0;
|
||||
Chip_SSP_WriteFrames_Blocking(LPC_SSP0, spi_data, 3);
|
||||
Chip_SSP_ReadFrames_Blocking(LPC_SSP0, pBuf, len);
|
||||
|
||||
WIZCHIP.CS._deselect();
|
||||
WIZCHIP_CRITICAL_EXIT();
|
||||
}
|
||||
|
||||
void WIZCHIP_WRITE_BUF(uint32_t AddrSel, uint8_t* pBuf, uint16_t len)
|
||||
{
|
||||
uint8_t spi_data[3];
|
||||
//uint16_t i;
|
||||
|
||||
WIZCHIP_CRITICAL_ENTER();
|
||||
WIZCHIP.CS._select();
|
||||
|
||||
AddrSel |= (_W5500_SPI_WRITE_ | _W5500_SPI_VDM_OP_);
|
||||
|
||||
//WIZCHIP.IF.SPI._write_byte((AddrSel & 0x00FF0000) >> 16);
|
||||
//WIZCHIP.IF.SPI._write_byte((AddrSel & 0x0000FF00) >> 8);
|
||||
//WIZCHIP.IF.SPI._write_byte((AddrSel & 0x000000FF) >> 0);
|
||||
//for(i = 0; i < len; i++)
|
||||
// WIZCHIP.IF.SPI._write_byte(pBuf[i]);
|
||||
spi_data[0] = (AddrSel & 0x00FF0000) >> 16;
|
||||
spi_data[1] = (AddrSel & 0x0000FF00) >> 8;
|
||||
spi_data[2] = (AddrSel & 0x000000FF) >> 0;
|
||||
Chip_SSP_WriteFrames_Blocking(LPC_SSP0, spi_data, 3);
|
||||
Chip_SSP_WriteFrames_Blocking(LPC_SSP0, pBuf, len);
|
||||
|
||||
WIZCHIP.CS._deselect();
|
||||
WIZCHIP_CRITICAL_EXIT();
|
||||
}
|
||||
|
||||
|
||||
uint16_t getSn_TX_FSR(uint8_t sn)
|
||||
{
|
||||
uint16_t val=0,val1=0;
|
||||
|
||||
do
|
||||
{
|
||||
val1 = WIZCHIP_READ(Sn_TX_FSR(sn));
|
||||
val1 = (val1 << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_FSR(sn),1));
|
||||
if (val1 != 0)
|
||||
{
|
||||
val = WIZCHIP_READ(Sn_TX_FSR(sn));
|
||||
val = (val << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_FSR(sn),1));
|
||||
}
|
||||
}while (val != val1);
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
uint16_t getSn_RX_RSR(uint8_t sn)
|
||||
{
|
||||
uint16_t val=0,val1=0;
|
||||
|
||||
do
|
||||
{
|
||||
val1 = WIZCHIP_READ(Sn_RX_RSR(sn));
|
||||
val1 = (val1 << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_RSR(sn),1));
|
||||
if (val1 != 0)
|
||||
{
|
||||
val = WIZCHIP_READ(Sn_RX_RSR(sn));
|
||||
val = (val << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_RSR(sn),1));
|
||||
}
|
||||
}while (val != val1);
|
||||
return val;
|
||||
}
|
||||
|
||||
void wiz_send_data(uint8_t sn, uint8_t *wizdata, uint16_t len)
|
||||
{
|
||||
uint16_t ptr = 0;
|
||||
uint32_t addrsel = 0;
|
||||
|
||||
if(len == 0) return;
|
||||
ptr = getSn_TX_WR(sn);
|
||||
//M20140501 : implict type casting -> explict type casting
|
||||
//addrsel = (ptr << 8) + (WIZCHIP_TXBUF_BLOCK(sn) << 3);
|
||||
addrsel = ((uint32_t)ptr << 8) + (WIZCHIP_TXBUF_BLOCK(sn) << 3);
|
||||
//
|
||||
WIZCHIP_WRITE_BUF(addrsel,wizdata, len);
|
||||
|
||||
ptr += len;
|
||||
setSn_TX_WR(sn,ptr);
|
||||
}
|
||||
|
||||
void wiz_recv_data(uint8_t sn, uint8_t *wizdata, uint16_t len)
|
||||
{
|
||||
uint16_t ptr = 0;
|
||||
uint32_t addrsel = 0;
|
||||
|
||||
if(len == 0) return;
|
||||
ptr = getSn_RX_RD(sn);
|
||||
//M20140501 : implict type casting -> explict type casting
|
||||
//addrsel = ((ptr << 8) + (WIZCHIP_RXBUF_BLOCK(sn) << 3);
|
||||
addrsel = ((uint32_t)ptr << 8) + (WIZCHIP_RXBUF_BLOCK(sn) << 3);
|
||||
//
|
||||
WIZCHIP_READ_BUF(addrsel, wizdata, len);
|
||||
ptr += len;
|
||||
|
||||
setSn_RX_RD(sn,ptr);
|
||||
}
|
||||
|
||||
|
||||
void wiz_recv_ignore(uint8_t sn, uint16_t len)
|
||||
{
|
||||
uint16_t ptr = 0;
|
||||
|
||||
ptr = getSn_RX_RD(sn);
|
||||
ptr += len;
|
||||
setSn_RX_RD(sn,ptr);
|
||||
}
|
||||
|
2057
drivers/wiznet5k/ethernet/w5500/w5500.h
Normal file
2057
drivers/wiznet5k/ethernet/w5500/w5500.h
Normal file
File diff suppressed because it is too large
Load Diff
662
drivers/wiznet5k/ethernet/wizchip_conf.c
Normal file
662
drivers/wiznet5k/ethernet/wizchip_conf.c
Normal file
@ -0,0 +1,662 @@
|
||||
//****************************************************************************/
|
||||
//!
|
||||
//! \file wizchip_conf.c
|
||||
//! \brief WIZCHIP Config Header File.
|
||||
//! \version 1.0.1
|
||||
//! \date 2013/10/21
|
||||
//! \par Revision history
|
||||
//! <2014/05/01> V1.0.1 Refer to M20140501
|
||||
//! 1. Explicit type casting in wizchip_bus_readbyte() & wizchip_bus_writebyte()
|
||||
// Issued by Mathias ClauBen.
|
||||
//! uint32_t type converts into ptrdiff_t first. And then recoverting it into uint8_t*
|
||||
//! For remove the warning when pointer type size is not 32bit.
|
||||
//! If ptrdiff_t doesn't support in your complier, You should must replace ptrdiff_t into your suitable pointer type.
|
||||
//! <2013/10/21> 1st Release
|
||||
//! \author MidnightCow
|
||||
//! \copyright
|
||||
//!
|
||||
//! Copyright (c) 2013, WIZnet Co., LTD.
|
||||
//! All rights reserved.
|
||||
//!
|
||||
//! Redistribution and use in source and binary forms, with or without
|
||||
//! modification, are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * Redistributions of source code must retain the above copyright
|
||||
//! notice, this list of conditions and the following disclaimer.
|
||||
//! * 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.
|
||||
//! * Neither the name of the <ORGANIZATION> nor the names of its
|
||||
//! contributors may be used to endorse or promote products derived
|
||||
//! from this software without specific prior written permission.
|
||||
//!
|
||||
//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
|
||||
//
|
||||
//*****************************************************************************/
|
||||
//A20140501 : for use the type - ptrdiff_t
|
||||
#include <stddef.h>
|
||||
//
|
||||
|
||||
#include "wizchip_conf.h"
|
||||
#include "socket.h"
|
||||
|
||||
/**
|
||||
* @brief Default function to enable interrupt.
|
||||
* @note This function help not to access wrong address. If you do not describe this function or register any functions,
|
||||
* null function is called.
|
||||
*/
|
||||
void wizchip_cris_enter(void) {};
|
||||
/**
|
||||
* @brief Default function to disable interrupt.
|
||||
* @note This function help not to access wrong address. If you do not describe this function or register any functions,
|
||||
* null function is called.
|
||||
*/
|
||||
void wizchip_cris_exit(void) {};
|
||||
/**
|
||||
* @brief Default function to select chip.
|
||||
* @note This function help not to access wrong address. If you do not describe this function or register any functions,
|
||||
* null function is called.
|
||||
*/
|
||||
void wizchip_cs_select(void) {};
|
||||
/**
|
||||
* @brief Default function to deselect chip.
|
||||
* @note This function help not to access wrong address. If you do not describe this function or register any functions,
|
||||
* null function is called.
|
||||
*/
|
||||
void wizchip_cs_deselect(void) {};
|
||||
/**
|
||||
* @brief Default function to read in direct or indirect interface.
|
||||
* @note This function help not to access wrong address. If you do not describe this function or register any functions,
|
||||
* null function is called.
|
||||
*/
|
||||
//M20140501 : Explict pointer type casting
|
||||
//uint8_t wizchip_bus_readbyte(uint32_t AddrSel) { return * ((volatile uint8_t *) AddrSel); };
|
||||
uint8_t wizchip_bus_readbyte(uint32_t AddrSel) { return * ((volatile uint8_t *)((ptrdiff_t) AddrSel)); };
|
||||
/**
|
||||
* @brief Default function to write in direct or indirect interface.
|
||||
* @note This function help not to access wrong address. If you do not describe this function or register any functions,
|
||||
* null function is called.
|
||||
*/
|
||||
|
||||
//M20140501 : Explict pointer type casting
|
||||
//void wizchip_bus_writebyte(uint32_t AddrSel, uint8_t wb) { *((volatile uint8_t*) AddrSel) = wb; };
|
||||
void wizchip_bus_writebyte(uint32_t AddrSel, uint8_t wb) { *((volatile uint8_t*)((ptrdiff_t)AddrSel)) = wb; };
|
||||
|
||||
/**
|
||||
* @brief Default function to read in SPI interface.
|
||||
* @note This function help not to access wrong address. If you do not describe this function or register any functions,
|
||||
* null function is called.
|
||||
*/
|
||||
void wizchip_spi_readbytes(uint8_t *buf, uint32_t len) {}
|
||||
/**
|
||||
* @brief Default function to write in SPI interface.
|
||||
* @note This function help not to access wrong address. If you do not describe this function or register any functions,
|
||||
* null function is called.
|
||||
*/
|
||||
void wizchip_spi_writebytes(const uint8_t *buf, uint32_t len) {}
|
||||
|
||||
/**
|
||||
* @\ref _WIZCHIP instance
|
||||
*/
|
||||
_WIZCHIP WIZCHIP =
|
||||
{
|
||||
.id = _WIZCHIP_ID_,
|
||||
.if_mode = _WIZCHIP_IO_MODE_,
|
||||
.CRIS._enter = wizchip_cris_enter,
|
||||
.CRIS._exit = wizchip_cris_exit,
|
||||
.CS._select = wizchip_cs_select,
|
||||
.CS._deselect = wizchip_cs_deselect,
|
||||
.IF.BUS._read_byte = wizchip_bus_readbyte,
|
||||
.IF.BUS._write_byte = wizchip_bus_writebyte
|
||||
// .IF.SPI._read_byte = wizchip_spi_readbyte,
|
||||
// .IF.SPI._write_byte = wizchip_spi_writebyte
|
||||
};
|
||||
|
||||
#if _WIZCHIP_ == 5200 // for W5200 ARP errata
|
||||
static uint8_t _SUBN_[4]; // subnet
|
||||
#endif
|
||||
static uint8_t _DNS_[4]; // DNS server ip address
|
||||
static dhcp_mode _DHCP_; // DHCP mode
|
||||
|
||||
void reg_wizchip_cris_cbfunc(void(*cris_en)(void), void(*cris_ex)(void))
|
||||
{
|
||||
if(!cris_en || !cris_ex)
|
||||
{
|
||||
WIZCHIP.CRIS._enter = wizchip_cris_enter;
|
||||
WIZCHIP.CRIS._exit = wizchip_cris_exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
WIZCHIP.CRIS._enter = cris_en;
|
||||
WIZCHIP.CRIS._exit = cris_ex;
|
||||
}
|
||||
}
|
||||
|
||||
void reg_wizchip_cs_cbfunc(void(*cs_sel)(void), void(*cs_desel)(void))
|
||||
{
|
||||
if(!cs_sel || !cs_desel)
|
||||
{
|
||||
WIZCHIP.CS._select = wizchip_cs_select;
|
||||
WIZCHIP.CS._deselect = wizchip_cs_deselect;
|
||||
}
|
||||
else
|
||||
{
|
||||
WIZCHIP.CS._select = cs_sel;
|
||||
WIZCHIP.CS._deselect = cs_desel;
|
||||
}
|
||||
}
|
||||
|
||||
void reg_wizchip_bus_cbfunc(uint8_t(*bus_rb)(uint32_t addr), void (*bus_wb)(uint32_t addr, uint8_t wb))
|
||||
{
|
||||
while(!(WIZCHIP.if_mode & _WIZCHIP_IO_MODE_BUS_));
|
||||
|
||||
if(!bus_rb || !bus_wb)
|
||||
{
|
||||
WIZCHIP.IF.BUS._read_byte = wizchip_bus_readbyte;
|
||||
WIZCHIP.IF.BUS._write_byte = wizchip_bus_writebyte;
|
||||
}
|
||||
else
|
||||
{
|
||||
WIZCHIP.IF.BUS._read_byte = bus_rb;
|
||||
WIZCHIP.IF.BUS._write_byte = bus_wb;
|
||||
}
|
||||
}
|
||||
|
||||
void reg_wizchip_spi_cbfunc(void (*spi_rb)(uint8_t *, uint32_t), void (*spi_wb)(const uint8_t *, uint32_t))
|
||||
{
|
||||
while(!(WIZCHIP.if_mode & _WIZCHIP_IO_MODE_SPI_));
|
||||
|
||||
if(!spi_rb || !spi_wb)
|
||||
{
|
||||
WIZCHIP.IF.SPI._read_bytes = wizchip_spi_readbytes;
|
||||
WIZCHIP.IF.SPI._write_bytes = wizchip_spi_writebytes;
|
||||
}
|
||||
else
|
||||
{
|
||||
WIZCHIP.IF.SPI._read_bytes = spi_rb;
|
||||
WIZCHIP.IF.SPI._write_bytes = spi_wb;
|
||||
}
|
||||
}
|
||||
|
||||
int8_t ctlwizchip(ctlwizchip_type cwtype, void* arg)
|
||||
{
|
||||
uint8_t tmp = 0;
|
||||
uint8_t* ptmp[2] = {0,0};
|
||||
switch(cwtype)
|
||||
{
|
||||
case CW_RESET_WIZCHIP:
|
||||
wizchip_sw_reset();
|
||||
break;
|
||||
case CW_INIT_WIZCHIP:
|
||||
if(arg != 0)
|
||||
{
|
||||
ptmp[0] = (uint8_t*)arg;
|
||||
ptmp[1] = ptmp[0] + _WIZCHIP_SOCK_NUM_;
|
||||
}
|
||||
return wizchip_init(ptmp[0], ptmp[1]);
|
||||
case CW_CLR_INTERRUPT:
|
||||
wizchip_clrinterrupt(*((intr_kind*)arg));
|
||||
break;
|
||||
case CW_GET_INTERRUPT:
|
||||
*((intr_kind*)arg) = wizchip_getinterrupt();
|
||||
break;
|
||||
case CW_SET_INTRMASK:
|
||||
wizchip_setinterruptmask(*((intr_kind*)arg));
|
||||
break;
|
||||
case CW_GET_INTRMASK:
|
||||
*((intr_kind*)arg) = wizchip_getinterruptmask();
|
||||
break;
|
||||
#if _WIZCHIP_ > 5100
|
||||
case CW_SET_INTRTIME:
|
||||
setINTLEVEL(*(uint16_t*)arg);
|
||||
break;
|
||||
case CW_GET_INTRTIME:
|
||||
*(uint16_t*)arg = getINTLEVEL();
|
||||
break;
|
||||
#endif
|
||||
case CW_GET_ID:
|
||||
((uint8_t*)arg)[0] = WIZCHIP.id[0];
|
||||
((uint8_t*)arg)[1] = WIZCHIP.id[1];
|
||||
((uint8_t*)arg)[2] = WIZCHIP.id[2];
|
||||
((uint8_t*)arg)[3] = WIZCHIP.id[3];
|
||||
((uint8_t*)arg)[4] = WIZCHIP.id[4];
|
||||
((uint8_t*)arg)[5] = 0;
|
||||
break;
|
||||
#if _WIZCHIP_ == 5500
|
||||
case CW_RESET_PHY:
|
||||
wizphy_reset();
|
||||
break;
|
||||
case CW_SET_PHYCONF:
|
||||
wizphy_setphyconf((wiz_PhyConf*)arg);
|
||||
break;
|
||||
case CW_GET_PHYCONF:
|
||||
wizphy_getphyconf((wiz_PhyConf*)arg);
|
||||
break;
|
||||
case CW_GET_PHYSTATUS:
|
||||
break;
|
||||
case CW_SET_PHYPOWMODE:
|
||||
return wizphy_setphypmode(*(uint8_t*)arg);
|
||||
#endif
|
||||
case CW_GET_PHYPOWMODE:
|
||||
tmp = wizphy_getphypmode();
|
||||
if((int8_t)tmp == -1) return -1;
|
||||
*(uint8_t*)arg = tmp;
|
||||
break;
|
||||
case CW_GET_PHYLINK:
|
||||
tmp = wizphy_getphylink();
|
||||
if((int8_t)tmp == -1) return -1;
|
||||
*(uint8_t*)arg = tmp;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int8_t ctlnetwork(ctlnetwork_type cntype, void* arg)
|
||||
{
|
||||
|
||||
switch(cntype)
|
||||
{
|
||||
case CN_SET_NETINFO:
|
||||
wizchip_setnetinfo((wiz_NetInfo*)arg);
|
||||
break;
|
||||
case CN_GET_NETINFO:
|
||||
wizchip_getnetinfo((wiz_NetInfo*)arg);
|
||||
break;
|
||||
case CN_SET_NETMODE:
|
||||
return wizchip_setnetmode(*(netmode_type*)arg);
|
||||
case CN_GET_NETMODE:
|
||||
*(netmode_type*)arg = wizchip_getnetmode();
|
||||
break;
|
||||
case CN_SET_TIMEOUT:
|
||||
wizchip_settimeout((wiz_NetTimeout*)arg);
|
||||
break;
|
||||
case CN_GET_TIMEOUT:
|
||||
wizchip_gettimeout((wiz_NetTimeout*)arg);
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wizchip_sw_reset(void)
|
||||
{
|
||||
uint8_t gw[4], sn[4], sip[4];
|
||||
uint8_t mac[6];
|
||||
getSHAR(mac);
|
||||
getGAR(gw); getSUBR(sn); getSIPR(sip);
|
||||
setMR(MR_RST);
|
||||
getMR(); // for delay
|
||||
setSHAR(mac);
|
||||
setGAR(gw);
|
||||
setSUBR(sn);
|
||||
setSIPR(sip);
|
||||
}
|
||||
|
||||
int8_t wizchip_init(uint8_t* txsize, uint8_t* rxsize)
|
||||
{
|
||||
int8_t i;
|
||||
int8_t tmp = 0;
|
||||
wizchip_sw_reset();
|
||||
if(txsize)
|
||||
{
|
||||
tmp = 0;
|
||||
for(i = 0 ; i < _WIZCHIP_SOCK_NUM_; i++)
|
||||
tmp += txsize[i];
|
||||
if(tmp > 16) return -1;
|
||||
for(i = 0 ; i < _WIZCHIP_SOCK_NUM_; i++)
|
||||
setSn_TXBUF_SIZE(i, txsize[i]);
|
||||
}
|
||||
if(rxsize)
|
||||
{
|
||||
tmp = 0;
|
||||
for(i = 0 ; i < _WIZCHIP_SOCK_NUM_; i++)
|
||||
tmp += rxsize[i];
|
||||
if(tmp > 16) return -1;
|
||||
for(i = 0 ; i < _WIZCHIP_SOCK_NUM_; i++)
|
||||
setSn_RXBUF_SIZE(i, rxsize[i]);
|
||||
}
|
||||
|
||||
WIZCHIP_EXPORT(socket_reset)();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wizchip_clrinterrupt(intr_kind intr)
|
||||
{
|
||||
uint8_t ir = (uint8_t)intr;
|
||||
uint8_t sir = (uint8_t)((uint16_t)intr >> 8);
|
||||
#if _WIZCHIP_ < 5500
|
||||
ir |= (1<<4); // IK_WOL
|
||||
#endif
|
||||
#if _WIZCHIP_ == 5200
|
||||
ir |= (1 << 6);
|
||||
#endif
|
||||
|
||||
#if _WIZCHIP_ < 5200
|
||||
sir &= 0x0F;
|
||||
#endif
|
||||
|
||||
#if _WIZCHIP_ == 5100
|
||||
ir |= sir;
|
||||
setIR(ir);
|
||||
#else
|
||||
setIR(ir);
|
||||
setSIR(sir);
|
||||
#endif
|
||||
}
|
||||
|
||||
intr_kind wizchip_getinterrupt(void)
|
||||
{
|
||||
uint8_t ir = 0;
|
||||
uint8_t sir = 0;
|
||||
uint16_t ret = 0;
|
||||
#if _WIZCHIP_ == 5100
|
||||
ir = getIR();
|
||||
sir = ir 0x0F;
|
||||
#else
|
||||
ir = getIR();
|
||||
sir = getSIR();
|
||||
#endif
|
||||
|
||||
#if _WIZCHIP_ < 5500
|
||||
ir &= ~(1<<4); // IK_WOL
|
||||
#endif
|
||||
#if _WIZCHIP_ == 5200
|
||||
ir &= ~(1 << 6);
|
||||
#endif
|
||||
ret = sir;
|
||||
ret = (ret << 8) + ir;
|
||||
return (intr_kind)ret;
|
||||
}
|
||||
|
||||
void wizchip_setinterruptmask(intr_kind intr)
|
||||
{
|
||||
uint8_t imr = (uint8_t)intr;
|
||||
uint8_t simr = (uint8_t)((uint16_t)intr >> 8);
|
||||
#if _WIZCHIP_ < 5500
|
||||
imr &= ~(1<<4); // IK_WOL
|
||||
#endif
|
||||
#if _WIZCHIP_ == 5200
|
||||
imr &= ~(1 << 6);
|
||||
#endif
|
||||
|
||||
#if _WIZCHIP_ < 5200
|
||||
simr &= 0x0F;
|
||||
#endif
|
||||
|
||||
#if _WIZCHIP_ == 5100
|
||||
imr |= simr;
|
||||
setIMR(imr);
|
||||
#else
|
||||
setIMR(imr);
|
||||
setSIMR(simr);
|
||||
#endif
|
||||
}
|
||||
|
||||
intr_kind wizchip_getinterruptmask(void)
|
||||
{
|
||||
uint8_t imr = 0;
|
||||
uint8_t simr = 0;
|
||||
uint16_t ret = 0;
|
||||
#if _WIZCHIP_ == 5100
|
||||
imr = getIMR();
|
||||
simr = imr 0x0F;
|
||||
#else
|
||||
imr = getIMR();
|
||||
simr = getSIMR();
|
||||
#endif
|
||||
|
||||
#if _WIZCHIP_ < 5500
|
||||
imr &= ~(1<<4); // IK_WOL
|
||||
#endif
|
||||
#if _WIZCHIP_ == 5200
|
||||
imr &= ~(1 << 6); // IK_DEST_UNREACH
|
||||
#endif
|
||||
ret = simr;
|
||||
ret = (ret << 8) + imr;
|
||||
return (intr_kind)ret;
|
||||
}
|
||||
|
||||
int8_t wizphy_getphylink(void)
|
||||
{
|
||||
int8_t tmp;
|
||||
#if _WIZCHIP_ == 5200
|
||||
if(getPHYSTATUS() & PHYSTATUS_LINK)
|
||||
tmp = PHY_LINK_ON;
|
||||
else
|
||||
tmp = PHY_LINK_OFF;
|
||||
#elif _WIZCHIP_ == 5500
|
||||
if(getPHYCFGR() & PHYCFGR_LNK_ON)
|
||||
tmp = PHY_LINK_ON;
|
||||
else
|
||||
tmp = PHY_LINK_OFF;
|
||||
#else
|
||||
tmp = -1;
|
||||
#endif
|
||||
return tmp;
|
||||
}
|
||||
|
||||
#if _WIZCHIP_ > 5100
|
||||
|
||||
int8_t wizphy_getphypmode(void)
|
||||
{
|
||||
int8_t tmp = 0;
|
||||
#if _WIZCHIP_ == 5200
|
||||
if(getPHYSTATUS() & PHYSTATUS_POWERDOWN)
|
||||
tmp = PHY_POWER_DOWN;
|
||||
else
|
||||
tmp = PHY_POWER_NORM;
|
||||
#elif _WIZCHIP_ == 5500
|
||||
if(getPHYCFGR() & PHYCFGR_OPMDC_PDOWN)
|
||||
tmp = PHY_POWER_DOWN;
|
||||
else
|
||||
tmp = PHY_POWER_NORM;
|
||||
#else
|
||||
tmp = -1;
|
||||
#endif
|
||||
return tmp;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _WIZCHIP_ == 5500
|
||||
void wizphy_reset(void)
|
||||
{
|
||||
uint8_t tmp = getPHYCFGR();
|
||||
tmp &= PHYCFGR_RST;
|
||||
setPHYCFGR(tmp);
|
||||
tmp = getPHYCFGR();
|
||||
tmp |= ~PHYCFGR_RST;
|
||||
setPHYCFGR(tmp);
|
||||
}
|
||||
|
||||
void wizphy_setphyconf(wiz_PhyConf* phyconf)
|
||||
{
|
||||
uint8_t tmp = 0;
|
||||
if(phyconf->by == PHY_CONFBY_SW)
|
||||
tmp |= PHYCFGR_OPMD;
|
||||
else
|
||||
tmp &= ~PHYCFGR_OPMD;
|
||||
if(phyconf->mode == PHY_MODE_AUTONEGO)
|
||||
tmp |= PHYCFGR_OPMDC_ALLA;
|
||||
else
|
||||
{
|
||||
if(phyconf->duplex == PHY_DUPLEX_FULL)
|
||||
{
|
||||
if(phyconf->speed == PHY_SPEED_100)
|
||||
tmp |= PHYCFGR_OPMDC_100F;
|
||||
else
|
||||
tmp |= PHYCFGR_OPMDC_10F;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(phyconf->speed == PHY_SPEED_100)
|
||||
tmp |= PHYCFGR_OPMDC_100H;
|
||||
else
|
||||
tmp |= PHYCFGR_OPMDC_10H;
|
||||
}
|
||||
}
|
||||
setPHYCFGR(tmp);
|
||||
wizphy_reset();
|
||||
}
|
||||
|
||||
void wizphy_getphyconf(wiz_PhyConf* phyconf)
|
||||
{
|
||||
uint8_t tmp = 0;
|
||||
tmp = getPHYCFGR();
|
||||
phyconf->by = (tmp & PHYCFGR_OPMD) ? PHY_CONFBY_SW : PHY_CONFBY_HW;
|
||||
switch(tmp & PHYCFGR_OPMDC_ALLA)
|
||||
{
|
||||
case PHYCFGR_OPMDC_ALLA:
|
||||
case PHYCFGR_OPMDC_100FA:
|
||||
phyconf->mode = PHY_MODE_AUTONEGO;
|
||||
break;
|
||||
default:
|
||||
phyconf->mode = PHY_MODE_MANUAL;
|
||||
break;
|
||||
}
|
||||
switch(tmp & PHYCFGR_OPMDC_ALLA)
|
||||
{
|
||||
case PHYCFGR_OPMDC_100FA:
|
||||
case PHYCFGR_OPMDC_100F:
|
||||
case PHYCFGR_OPMDC_100H:
|
||||
phyconf->speed = PHY_SPEED_100;
|
||||
break;
|
||||
default:
|
||||
phyconf->speed = PHY_SPEED_10;
|
||||
break;
|
||||
}
|
||||
switch(tmp & PHYCFGR_OPMDC_ALLA)
|
||||
{
|
||||
case PHYCFGR_OPMDC_100FA:
|
||||
case PHYCFGR_OPMDC_100F:
|
||||
case PHYCFGR_OPMDC_10F:
|
||||
phyconf->duplex = PHY_DUPLEX_FULL;
|
||||
break;
|
||||
default:
|
||||
phyconf->duplex = PHY_DUPLEX_HALF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void wizphy_getphystat(wiz_PhyConf* phyconf)
|
||||
{
|
||||
uint8_t tmp = getPHYCFGR();
|
||||
phyconf->duplex = (tmp & PHYCFGR_DPX_FULL) ? PHY_DUPLEX_FULL : PHY_DUPLEX_HALF;
|
||||
phyconf->speed = (tmp & PHYCFGR_SPD_100) ? PHY_SPEED_100 : PHY_SPEED_10;
|
||||
}
|
||||
|
||||
int8_t wizphy_setphypmode(uint8_t pmode)
|
||||
{
|
||||
uint8_t tmp = 0;
|
||||
tmp = getPHYCFGR();
|
||||
if((tmp & PHYCFGR_OPMD)== 0) return -1;
|
||||
tmp &= ~PHYCFGR_OPMDC_ALLA;
|
||||
if( pmode == PHY_POWER_DOWN)
|
||||
tmp |= PHYCFGR_OPMDC_PDOWN;
|
||||
else
|
||||
tmp |= PHYCFGR_OPMDC_ALLA;
|
||||
setPHYCFGR(tmp);
|
||||
wizphy_reset();
|
||||
tmp = getPHYCFGR();
|
||||
if( pmode == PHY_POWER_DOWN)
|
||||
{
|
||||
if(tmp & PHYCFGR_OPMDC_PDOWN) return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(tmp & PHYCFGR_OPMDC_ALLA) return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void wizchip_setnetinfo(wiz_NetInfo* pnetinfo)
|
||||
{
|
||||
setSHAR(pnetinfo->mac);
|
||||
setGAR(pnetinfo->gw);
|
||||
setSUBR(pnetinfo->sn);
|
||||
setSIPR(pnetinfo->ip);
|
||||
#if _WIZCHIP_ == 5200 // for W5200 ARP errata
|
||||
_SUBN_[0] = pnetinfo->sn[0];
|
||||
_SUBN_[1] = pnetinfo->sn[1];
|
||||
_SUBN_[2] = pnetinfo->sn[2];
|
||||
_SUBN_[3] = pnetinfo->sn[3];
|
||||
#endif
|
||||
_DNS_[0] = pnetinfo->dns[0];
|
||||
_DNS_[1] = pnetinfo->dns[1];
|
||||
_DNS_[2] = pnetinfo->dns[2];
|
||||
_DNS_[3] = pnetinfo->dns[3];
|
||||
_DHCP_ = pnetinfo->dhcp;
|
||||
}
|
||||
|
||||
void wizchip_getnetinfo(wiz_NetInfo* pnetinfo)
|
||||
{
|
||||
getSHAR(pnetinfo->mac);
|
||||
getGAR(pnetinfo->gw);
|
||||
getSUBR(pnetinfo->sn);
|
||||
getSIPR(pnetinfo->ip);
|
||||
#if _WIZCHIP_ == 5200 // for W5200 ARP errata
|
||||
pnetinfo->sn[0] = _SUBN_[0];
|
||||
pnetinfo->sn[1] = _SUBN_[1];
|
||||
pnetinfo->sn[2] = _SUBN_[2];
|
||||
pnetinfo->sn[3] = _SUBN_[3];
|
||||
#endif
|
||||
pnetinfo->dns[0]= _DNS_[0];
|
||||
pnetinfo->dns[1]= _DNS_[1];
|
||||
pnetinfo->dns[2]= _DNS_[2];
|
||||
pnetinfo->dns[3]= _DNS_[3];
|
||||
pnetinfo->dhcp = _DHCP_;
|
||||
}
|
||||
|
||||
#if _WIZCHIP_ == 5200 // for W5200 ARP errata
|
||||
uint8_t *wizchip_getsubn(void) {
|
||||
return _SUBN_;
|
||||
}
|
||||
#endif
|
||||
|
||||
int8_t wizchip_setnetmode(netmode_type netmode)
|
||||
{
|
||||
uint8_t tmp = 0;
|
||||
#if _WIZCHIP_ != 5500
|
||||
if(netmode & ~(NM_WAKEONLAN | NM_PPPOE | NM_PINGBLOCK)) return -1;
|
||||
#else
|
||||
if(netmode & ~(NM_WAKEONLAN | NM_PPPOE | NM_PINGBLOCK | NM_FORCEARP)) return -1;
|
||||
#endif
|
||||
tmp = getMR();
|
||||
tmp |= (uint8_t)netmode;
|
||||
setMR(tmp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
netmode_type wizchip_getnetmode(void)
|
||||
{
|
||||
return (netmode_type) getMR();
|
||||
}
|
||||
|
||||
void wizchip_settimeout(wiz_NetTimeout* nettime)
|
||||
{
|
||||
setRCR(nettime->retry_cnt);
|
||||
setRTR(nettime->time_100us);
|
||||
}
|
||||
|
||||
void wizchip_gettimeout(wiz_NetTimeout* nettime)
|
||||
{
|
||||
nettime->retry_cnt = getRCR();
|
||||
nettime->time_100us = getRTR();
|
||||
}
|
554
drivers/wiznet5k/ethernet/wizchip_conf.h
Normal file
554
drivers/wiznet5k/ethernet/wizchip_conf.h
Normal file
@ -0,0 +1,554 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \file wizchip_conf.h
|
||||
//! \brief WIZCHIP Config Header File.
|
||||
//! \version 1.0.0
|
||||
//! \date 2013/10/21
|
||||
//! \par Revision history
|
||||
//! <2013/10/21> 1st Release
|
||||
//! \author MidnightCow
|
||||
//! \copyright
|
||||
//!
|
||||
//! Copyright (c) 2013, WIZnet Co., LTD.
|
||||
//! All rights reserved.
|
||||
//!
|
||||
//! Redistribution and use in source and binary forms, with or without
|
||||
//! modification, are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * Redistributions of source code must retain the above copyright
|
||||
//! notice, this list of conditions and the following disclaimer.
|
||||
//! * 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.
|
||||
//! * Neither the name of the <ORGANIZATION> nor the names of its
|
||||
//! contributors may be used to endorse or promote products derived
|
||||
//! from this software without specific prior written permission.
|
||||
//!
|
||||
//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
/**
|
||||
* @defgroup extra_functions 2. WIZnet Extra Functions
|
||||
*
|
||||
* @brief These functions is optional function. It could be replaced at WIZCHIP I/O function because they were made by WIZCHIP I/O functions.
|
||||
* @details There are functions of configuring WIZCHIP, network, interrupt, phy, network information and timer. \n
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _WIZCHIP_CONF_H_
|
||||
#define _WIZCHIP_CONF_H_
|
||||
|
||||
#include <stdint.h>
|
||||
/**
|
||||
* @brief Select WIZCHIP.
|
||||
* @todo You should select one, \b 5100, \b 5200 ,\b 5500 or etc. \n\n
|
||||
* ex> <code> #define \_WIZCHIP_ 5500 </code>
|
||||
*/
|
||||
#ifndef _WIZCHIP_
|
||||
#define _WIZCHIP_ 5200 // 5100, 5200, 5500
|
||||
#endif
|
||||
|
||||
#define _WIZCHIP_IO_MODE_NONE_ 0x0000
|
||||
#define _WIZCHIP_IO_MODE_BUS_ 0x0100 /**< Bus interface mode */
|
||||
#define _WIZCHIP_IO_MODE_SPI_ 0x0200 /**< SPI interface mode */
|
||||
//#define _WIZCHIP_IO_MODE_IIC_ 0x0400
|
||||
//#define _WIZCHIP_IO_MODE_SDIO_ 0x0800
|
||||
// Add to
|
||||
//
|
||||
|
||||
#define _WIZCHIP_IO_MODE_BUS_DIR_ (_WIZCHIP_IO_MODE_BUS_ + 1) /**< BUS interface mode for direct */
|
||||
#define _WIZCHIP_IO_MODE_BUS_INDIR_ (_WIZCHIP_IO_MODE_BUS_ + 2) /**< BUS interface mode for indirect */
|
||||
|
||||
#define _WIZCHIP_IO_MODE_SPI_VDM_ (_WIZCHIP_IO_MODE_SPI_ + 1) /**< SPI interface mode for variable length data*/
|
||||
#define _WIZCHIP_IO_MODE_SPI_FDM_ (_WIZCHIP_IO_MODE_SPI_ + 2) /**< SPI interface mode for fixed length data mode*/
|
||||
|
||||
|
||||
#if (_WIZCHIP_ == 5100)
|
||||
#define _WIZCHIP_ID_ "W5100\0"
|
||||
/**
|
||||
* @brief Define interface mode.
|
||||
* @todo you should select interface mode as chip. Select one of @ref \_WIZCHIP_IO_MODE_SPI_ , @ref \_WIZCHIP_IO_MODE_BUS_DIR_ or @ref \_WIZCHIP_IO_MODE_BUS_INDIR_
|
||||
*/
|
||||
|
||||
// #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_BUS_DIR_
|
||||
// #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_BUS_INDIR_
|
||||
#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_
|
||||
|
||||
#elif (_WIZCHIP_ == 5200)
|
||||
#define _WIZCHIP_ID_ "W5200\0"
|
||||
/**
|
||||
* @brief Define interface mode.
|
||||
* @todo you should select interface mode as chip. Select one of @ref \_WIZCHIP_IO_MODE_SPI_ or @ref \_WIZCHIP_IO_MODE_BUS_INDIR_
|
||||
*/
|
||||
// #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_BUS_INDIR_
|
||||
#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_
|
||||
#include "w5200/w5200.h"
|
||||
#elif (_WIZCHIP_ == 5500)
|
||||
#define _WIZCHIP_ID_ "W5500\0"
|
||||
|
||||
/**
|
||||
* @brief Define interface mode. \n
|
||||
* @todo Should select interface mode as chip.
|
||||
* - @ref \_WIZCHIP_IO_MODE_SPI_ \n
|
||||
* -@ref \_WIZCHIP_IO_MODE_SPI_VDM_ : Valid only in @ref \_WIZCHIP_ == 5500 \n
|
||||
* -@ref \_WIZCHIP_IO_MODE_SPI_FDM_ : Valid only in @ref \_WIZCHIP_ == 5500 \n
|
||||
* - @ref \_WIZCHIP_IO_MODE_BUS_ \n
|
||||
* - @ref \_WIZCHIP_IO_MODE_BUS_DIR_ \n
|
||||
* - @ref \_WIZCHIP_IO_MODE_BUS_INDIR_ \n
|
||||
* - Others will be defined in future. \n\n
|
||||
* ex> <code> #define \_WIZCHIP_IO_MODE_ \_WIZCHIP_IO_MODE_SPI_VDM_ </code>
|
||||
*
|
||||
*/
|
||||
//#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_FDM_
|
||||
#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_VDM_
|
||||
#include "w5500/w5500.h"
|
||||
#else
|
||||
#error "Unknown defined _WIZCHIP_. You should define one of 5100, 5200, and 5500 !!!"
|
||||
#endif
|
||||
|
||||
#ifndef _WIZCHIP_IO_MODE_
|
||||
#error "Undefined _WIZCHIP_IO_MODE_. You should define it !!!"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Define I/O base address when BUS IF mode.
|
||||
* @todo Should re-define it to fit your system when BUS IF Mode (@ref \_WIZCHIP_IO_MODE_BUS_,
|
||||
* @ref \_WIZCHIP_IO_MODE_BUS_DIR_, @ref \_WIZCHIP_IO_MODE_BUS_INDIR_). \n\n
|
||||
* ex> <code> #define \_WIZCHIP_IO_BASE_ 0x00008000 </code>
|
||||
*/
|
||||
#define _WIZCHIP_IO_BASE_ 0x00000000 //
|
||||
|
||||
#if _WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_BUS_
|
||||
#ifndef _WIZCHIP_IO_BASE_
|
||||
#error "You should be define _WIZCHIP_IO_BASE to fit your system memory map."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if _WIZCHIP_ > 5100
|
||||
#define _WIZCHIP_SOCK_NUM_ 8 ///< The count of independant socket of @b WIZCHIP
|
||||
#else
|
||||
#define _WIZCHIP_SOCK_NUM_ 4 ///< The count of independant socket of @b WIZCHIP
|
||||
#endif
|
||||
|
||||
|
||||
/********************************************************
|
||||
* WIZCHIP BASIC IF functions for SPI, SDIO, I2C , ETC.
|
||||
*********************************************************/
|
||||
/**
|
||||
* @ingroup DATA_TYPE
|
||||
* @brief The set of callback functions for W5500:@ref WIZCHIP_IO_Functions W5200:@ref WIZCHIP_IO_Functions_W5200
|
||||
*/
|
||||
typedef struct __WIZCHIP
|
||||
{
|
||||
uint16_t if_mode; ///< host interface mode
|
||||
uint8_t id[6]; ///< @b WIZCHIP ID such as @b 5100, @b 5200, @b 5500, and so on.
|
||||
/**
|
||||
* The set of critical section callback func.
|
||||
*/
|
||||
struct _CRIS
|
||||
{
|
||||
void (*_enter) (void); ///< crtical section enter
|
||||
void (*_exit) (void); ///< critial section exit
|
||||
}CRIS;
|
||||
/**
|
||||
* The set of @ref\_WIZCHIP_ select control callback func.
|
||||
*/
|
||||
struct _CS
|
||||
{
|
||||
void (*_select) (void); ///< @ref \_WIZCHIP_ selected
|
||||
void (*_deselect)(void); ///< @ref \_WIZCHIP_ deselected
|
||||
}CS;
|
||||
/**
|
||||
* The set of interface IO callback func.
|
||||
*/
|
||||
union _IF
|
||||
{
|
||||
/**
|
||||
* For BUS interface IO
|
||||
*/
|
||||
struct
|
||||
{
|
||||
uint8_t (*_read_byte) (uint32_t AddrSel);
|
||||
void (*_write_byte) (uint32_t AddrSel, uint8_t wb);
|
||||
}BUS;
|
||||
/**
|
||||
* For SPI interface IO
|
||||
*/
|
||||
struct
|
||||
{
|
||||
void (*_read_bytes) (uint8_t *buf, uint32_t len);
|
||||
void (*_write_bytes) (const uint8_t *buf, uint32_t len);
|
||||
}SPI;
|
||||
// To be added
|
||||
//
|
||||
}IF;
|
||||
}_WIZCHIP;
|
||||
|
||||
extern _WIZCHIP WIZCHIP;
|
||||
|
||||
/**
|
||||
* @ingroup DATA_TYPE
|
||||
* WIZCHIP control type enumration used in @ref ctlwizchip().
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CW_RESET_WIZCHIP, ///< Resets WIZCHIP by softly
|
||||
CW_INIT_WIZCHIP, ///< Inializes to WIZCHIP with SOCKET buffer size 2 or 1 dimension array typed uint8_t.
|
||||
CW_GET_INTERRUPT, ///< Get Interrupt status of WIZCHIP
|
||||
CW_CLR_INTERRUPT, ///< Clears interrupt
|
||||
CW_SET_INTRMASK, ///< Masks interrupt
|
||||
CW_GET_INTRMASK, ///< Get interrupt mask
|
||||
CW_SET_INTRTIME, ///< Set interval time between the current and next interrupt.
|
||||
CW_GET_INTRTIME, ///< Set interval time between the current and next interrupt.
|
||||
CW_GET_ID, ///< Gets WIZCHIP name.
|
||||
|
||||
#if _WIZCHIP_ == 5500
|
||||
CW_RESET_PHY, ///< Resets internal PHY. Valid Only W5000
|
||||
CW_SET_PHYCONF, ///< When PHY configured by interal register, PHY operation mode (Manual/Auto, 10/100, Half/Full). Valid Only W5000
|
||||
CW_GET_PHYCONF, ///< Get PHY operation mode in interal register. Valid Only W5000
|
||||
CW_GET_PHYSTATUS, ///< Get real PHY status on operating. Valid Only W5000
|
||||
CW_SET_PHYPOWMODE, ///< Set PHY power mode as noraml and down when PHYSTATUS.OPMD == 1. Valid Only W5000
|
||||
#endif
|
||||
CW_GET_PHYPOWMODE, ///< Get PHY Power mode as down or normal
|
||||
CW_GET_PHYLINK ///< Get PHY Link status
|
||||
}ctlwizchip_type;
|
||||
|
||||
/**
|
||||
* @ingroup DATA_TYPE
|
||||
* Network control type enumration used in @ref ctlnetwork().
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CN_SET_NETINFO, ///< Set Network with @ref wiz_NetInfo
|
||||
CN_GET_NETINFO, ///< Get Network with @ref wiz_NetInfo
|
||||
CN_SET_NETMODE, ///< Set network mode as WOL, PPPoE, Ping Block, and Force ARP mode
|
||||
CN_GET_NETMODE, ///< Get network mode as WOL, PPPoE, Ping Block, and Force ARP mode
|
||||
CN_SET_TIMEOUT, ///< Set network timeout as retry count and time.
|
||||
CN_GET_TIMEOUT, ///< Get network timeout as retry count and time.
|
||||
}ctlnetwork_type;
|
||||
|
||||
/**
|
||||
* @ingroup DATA_TYPE
|
||||
* Interrupt kind when CW_SET_INTRRUPT, CW_GET_INTERRUPT, CW_SET_INTRMASK
|
||||
* and CW_GET_INTRMASK is used in @ref ctlnetwork().
|
||||
* It can be used with OR operation.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
#if _WIZCHIP_ > 5200
|
||||
IK_WOL = (1 << 4), ///< Wake On Lan by receiving the magic packet. Valid in W500.
|
||||
#endif
|
||||
|
||||
IK_PPPOE_TERMINATED = (1 << 5), ///< PPPoE Disconnected
|
||||
|
||||
#if _WIZCHIP_ != 5200
|
||||
IK_DEST_UNREACH = (1 << 6), ///< Destination IP & Port Unreable, No use in W5200
|
||||
#endif
|
||||
|
||||
IK_IP_CONFLICT = (1 << 7), ///< IP conflict occurred
|
||||
|
||||
IK_SOCK_0 = (1 << 8), ///< Socket 0 interrupt
|
||||
IK_SOCK_1 = (1 << 9), ///< Socket 1 interrupt
|
||||
IK_SOCK_2 = (1 << 10), ///< Socket 2 interrupt
|
||||
IK_SOCK_3 = (1 << 11), ///< Socket 3 interrupt
|
||||
#if _WIZCHIP_ > 5100
|
||||
IK_SOCK_4 = (1 << 12), ///< Socket 4 interrupt, No use in 5100
|
||||
IK_SOCK_5 = (1 << 13), ///< Socket 5 interrupt, No use in 5100
|
||||
IK_SOCK_6 = (1 << 14), ///< Socket 6 interrupt, No use in 5100
|
||||
IK_SOCK_7 = (1 << 15), ///< Socket 7 interrupt, No use in 5100
|
||||
#endif
|
||||
|
||||
#if _WIZCHIP_ > 5100
|
||||
IK_SOCK_ALL = (0xFF << 8) ///< All Socket interrpt
|
||||
#else
|
||||
IK_SOCK_ALL = (0x0F << 8) ///< All Socket interrpt
|
||||
#endif
|
||||
}intr_kind;
|
||||
|
||||
#define PHY_CONFBY_HW 0 ///< Configured PHY operation mode by HW pin
|
||||
#define PHY_CONFBY_SW 1 ///< Configured PHY operation mode by SW register
|
||||
#define PHY_MODE_MANUAL 0 ///< Configured PHY operation mode with user setting.
|
||||
#define PHY_MODE_AUTONEGO 1 ///< Configured PHY operation mode with auto-negotiation
|
||||
#define PHY_SPEED_10 0 ///< Link Speed 10
|
||||
#define PHY_SPEED_100 1 ///< Link Speed 100
|
||||
#define PHY_DUPLEX_HALF 0 ///< Link Half-Duplex
|
||||
#define PHY_DUPLEX_FULL 1 ///< Link Full-Duplex
|
||||
#define PHY_LINK_OFF 0 ///< Link Off
|
||||
#define PHY_LINK_ON 1 ///< Link On
|
||||
#define PHY_POWER_NORM 0 ///< PHY power normal mode
|
||||
#define PHY_POWER_DOWN 1 ///< PHY power down mode
|
||||
|
||||
|
||||
#if _WIZCHIP_ == 5500
|
||||
/**
|
||||
* @ingroup DATA_TYPE
|
||||
* It configures PHY configuration when CW_SET PHYCONF or CW_GET_PHYCONF in W5500,
|
||||
* and it indicates the real PHY status configured by HW or SW in all WIZCHIP. \n
|
||||
* Valid only in W5500.
|
||||
*/
|
||||
typedef struct wiz_PhyConf_t
|
||||
{
|
||||
uint8_t by; ///< set by @ref PHY_CONFBY_HW or @ref PHY_CONFBY_SW
|
||||
uint8_t mode; ///< set by @ref PHY_MODE_MANUAL or @ref PHY_MODE_AUTONEGO
|
||||
uint8_t speed; ///< set by @ref PHY_SPEED_10 or @ref PHY_SPEED_100
|
||||
uint8_t duplex; ///< set by @ref PHY_DUPLEX_HALF @ref PHY_DUPLEX_FULL
|
||||
//uint8_t power; ///< set by @ref PHY_POWER_NORM or @ref PHY_POWER_DOWN
|
||||
//uint8_t link; ///< Valid only in CW_GET_PHYSTATUS. set by @ref PHY_LINK_ON or PHY_DUPLEX_OFF
|
||||
}wiz_PhyConf;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup DATA_TYPE
|
||||
* It used in setting dhcp_mode of @ref wiz_NetInfo.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NETINFO_STATIC = 1, ///< Static IP configuration by manually.
|
||||
NETINFO_DHCP ///< Dynamic IP configruation from a DHCP sever
|
||||
}dhcp_mode;
|
||||
|
||||
/**
|
||||
* @ingroup DATA_TYPE
|
||||
* Network Information for WIZCHIP
|
||||
*/
|
||||
typedef struct wiz_NetInfo_t
|
||||
{
|
||||
uint8_t mac[6]; ///< Source Mac Address
|
||||
uint8_t ip[4]; ///< Source IP Address
|
||||
uint8_t sn[4]; ///< Subnet Mask
|
||||
uint8_t gw[4]; ///< Gateway IP Address
|
||||
uint8_t dns[4]; ///< DNS server IP Address
|
||||
dhcp_mode dhcp; ///< 1 - Static, 2 - DHCP
|
||||
}wiz_NetInfo;
|
||||
|
||||
/**
|
||||
* @ingroup DATA_TYPE
|
||||
* Network mode
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
#if _WIZCHIP_ == 5500
|
||||
NM_FORCEARP = (1<<1), ///< Force to APP send whenever udp data is sent. Valid only in W5500
|
||||
#endif
|
||||
NM_WAKEONLAN = (1<<5), ///< Wake On Lan
|
||||
NM_PINGBLOCK = (1<<4), ///< Block ping-request
|
||||
NM_PPPOE = (1<<3), ///< PPPoE mode
|
||||
}netmode_type;
|
||||
|
||||
/**
|
||||
* @ingroup DATA_TYPE
|
||||
* Used in CN_SET_TIMEOUT or CN_GET_TIMEOUT of @ref ctlwizchip() for timeout configruation.
|
||||
*/
|
||||
typedef struct wiz_NetTimeout_t
|
||||
{
|
||||
uint8_t retry_cnt; ///< retry count
|
||||
uint16_t time_100us; ///< time unit 100us
|
||||
}wiz_NetTimeout;
|
||||
|
||||
/**
|
||||
*@brief Registers call back function for critical section of I/O functions such as
|
||||
*\ref WIZCHIP_READ, @ref WIZCHIP_WRITE, @ref WIZCHIP_READ_BUF and @ref WIZCHIP_WRITE_BUF.
|
||||
*@param cris_en : callback function for critical section enter.
|
||||
*@param cris_ex : callback function for critical section exit.
|
||||
*@todo Describe @ref WIZCHIP_CRITICAL_ENTER and @ref WIZCHIP_CRITICAL_EXIT marco or register your functions.
|
||||
*@note If you do not describe or register, default functions(@ref wizchip_cris_enter & @ref wizchip_cris_exit) is called.
|
||||
*/
|
||||
void reg_wizchip_cris_cbfunc(void(*cris_en)(void), void(*cris_ex)(void));
|
||||
|
||||
|
||||
/**
|
||||
*@brief Registers call back function for WIZCHIP select & deselect.
|
||||
*@param cs_sel : callback function for WIZCHIP select
|
||||
*@param cs_desel : callback fucntion for WIZCHIP deselect
|
||||
*@todo Describe @ref wizchip_cs_select and @ref wizchip_cs_deselect function or register your functions.
|
||||
*@note If you do not describe or register, null function is called.
|
||||
*/
|
||||
void reg_wizchip_cs_cbfunc(void(*cs_sel)(void), void(*cs_desel)(void));
|
||||
|
||||
/**
|
||||
*@brief Registers call back function for bus interface.
|
||||
*@param bus_rb : callback function to read byte data using system bus
|
||||
*@param bus_wb : callback function to write byte data using system bus
|
||||
*@todo Describe @ref wizchip_bus_readbyte and @ref wizchip_bus_writebyte function
|
||||
*or register your functions.
|
||||
*@note If you do not describe or register, null function is called.
|
||||
*/
|
||||
void reg_wizchip_bus_cbfunc(uint8_t (*bus_rb)(uint32_t addr), void (*bus_wb)(uint32_t addr, uint8_t wb));
|
||||
|
||||
/**
|
||||
*@brief Registers call back function for SPI interface.
|
||||
*@param spi_rb : callback function to read byte usig SPI
|
||||
*@param spi_wb : callback function to write byte usig SPI
|
||||
*@todo Describe \ref wizchip_spi_readbyte and \ref wizchip_spi_writebyte function
|
||||
*or register your functions.
|
||||
*@note If you do not describe or register, null function is called.
|
||||
*/
|
||||
void reg_wizchip_spi_cbfunc(void (*spi_rb)(uint8_t *, uint32_t), void (*spi_wb)(const uint8_t *, uint32_t));
|
||||
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Controls to the WIZCHIP.
|
||||
* @details Resets WIZCHIP & internal PHY, Configures PHY mode, Monitor PHY(Link,Speed,Half/Full/Auto),
|
||||
* controls interrupt & mask and so on.
|
||||
* @param cwtype : Decides to the control type
|
||||
* @param arg : arg type is dependent on cwtype.
|
||||
* @return 0 : Success \n
|
||||
* -1 : Fail because of invalid \ref ctlwizchip_type or unsupported \ref ctlwizchip_type in WIZCHIP
|
||||
*/
|
||||
int8_t ctlwizchip(ctlwizchip_type cwtype, void* arg);
|
||||
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Controls to network.
|
||||
* @details Controls to network environment, mode, timeout and so on.
|
||||
* @param cntype : Input. Decides to the control type
|
||||
* @param arg : Inout. arg type is dependent on cntype.
|
||||
* @return -1 : Fail because of invalid \ref ctlnetwork_type or unsupported \ref ctlnetwork_type in WIZCHIP \n
|
||||
* 0 : Success
|
||||
*/
|
||||
int8_t ctlnetwork(ctlnetwork_type cntype, void* arg);
|
||||
|
||||
|
||||
/*
|
||||
* The following functions are implemented for internal use.
|
||||
* but You can call these functions for code size reduction instead of ctlwizchip() and ctlnetwork().
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Reset WIZCHIP by softly.
|
||||
*/
|
||||
void wizchip_sw_reset(void);
|
||||
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Initializes WIZCHIP with socket buffer size
|
||||
* @param txsize Socket tx buffer sizes. If null, initialized the default size 2KB.
|
||||
* @param rxsize Socket rx buffer sizes. If null, initialized the default size 2KB.
|
||||
* @return 0 : succcess \n
|
||||
* -1 : fail. Invalid buffer size
|
||||
*/
|
||||
int8_t wizchip_init(uint8_t* txsize, uint8_t* rxsize);
|
||||
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Clear Interrupt of WIZCHIP.
|
||||
* @param intr : @ref intr_kind value operated OR. It can type-cast to uint16_t.
|
||||
*/
|
||||
void wizchip_clrinterrupt(intr_kind intr);
|
||||
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Get Interrupt of WIZCHIP.
|
||||
* @return @ref intr_kind value operated OR. It can type-cast to uint16_t.
|
||||
*/
|
||||
intr_kind wizchip_getinterrupt(void);
|
||||
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Mask or Unmask Interrupt of WIZCHIP.
|
||||
* @param intr : @ref intr_kind value operated OR. It can type-cast to uint16_t.
|
||||
*/
|
||||
void wizchip_setinterruptmask(intr_kind intr);
|
||||
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Get Interrupt mask of WIZCHIP.
|
||||
* @return : The operated OR vaule of @ref intr_kind. It can type-cast to uint16_t.
|
||||
*/
|
||||
intr_kind wizchip_getinterruptmask(void);
|
||||
|
||||
#if _WIZCHIP_ > 5100
|
||||
int8_t wizphy_getphylink(void); ///< get the link status of phy in WIZCHIP. No use in W5100
|
||||
int8_t wizphy_getphypmode(void); ///< get the power mode of PHY in WIZCHIP. No use in W5100
|
||||
#endif
|
||||
|
||||
#if _WIZCHIP_ == 5500
|
||||
void wizphy_reset(void); ///< Reset phy. Vailid only in W5500
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Set the phy information for WIZCHIP without power mode
|
||||
* @param phyconf : @ref wiz_PhyConf
|
||||
*/
|
||||
void wizphy_setphyconf(wiz_PhyConf* phyconf);
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Get phy configuration information.
|
||||
* @param phyconf : @ref wiz_PhyConf
|
||||
*/
|
||||
void wizphy_getphyconf(wiz_PhyConf* phyconf);
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Get phy status.
|
||||
* @param phyconf : @ref wiz_PhyConf
|
||||
*/
|
||||
void wizphy_getphystat(wiz_PhyConf* phyconf);
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief set the power mode of phy inside WIZCHIP. Refer to @ref PHYCFGR in W5500, @ref PHYSTATUS in W5200
|
||||
* @param pmode Settig value of power down mode.
|
||||
*/
|
||||
int8_t wizphy_setphypmode(uint8_t pmode);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Set the network information for WIZCHIP
|
||||
* @param pnetinfo : @ref wizNetInfo
|
||||
*/
|
||||
void wizchip_setnetinfo(wiz_NetInfo* pnetinfo);
|
||||
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Get the network information for WIZCHIP
|
||||
* @param pnetinfo : @ref wizNetInfo
|
||||
*/
|
||||
void wizchip_getnetinfo(wiz_NetInfo* pnetinfo);
|
||||
|
||||
#if _WIZCHIP_ == 5200 // for W5200 ARP errata
|
||||
uint8_t *wizchip_getsubn(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Set the network mode such WOL, PPPoE, Ping Block, and etc.
|
||||
* @param pnetinfo Value of network mode. Refer to @ref netmode_type.
|
||||
*/
|
||||
int8_t wizchip_setnetmode(netmode_type netmode);
|
||||
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Get the network mode such WOL, PPPoE, Ping Block, and etc.
|
||||
* @return Value of network mode. Refer to @ref netmode_type.
|
||||
*/
|
||||
netmode_type wizchip_getnetmode(void);
|
||||
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Set retry time value(@ref RTR) and retry count(@ref RCR).
|
||||
* @details @ref RTR configures the retransmission timeout period and @ref RCR configures the number of time of retransmission.
|
||||
* @param nettime @ref RTR value and @ref RCR value. Refer to @ref wiz_NetTimeout.
|
||||
*/
|
||||
void wizchip_settimeout(wiz_NetTimeout* nettime);
|
||||
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
* @brief Get retry time value(@ref RTR) and retry count(@ref RCR).
|
||||
* @details @ref RTR configures the retransmission timeout period and @ref RCR configures the number of time of retransmission.
|
||||
* @param nettime @ref RTR value and @ref RCR value. Refer to @ref wiz_NetTimeout.
|
||||
*/
|
||||
void wizchip_gettimeout(wiz_NetTimeout* nettime);
|
||||
|
||||
#endif // _WIZCHIP_CONF_H_
|
979
drivers/wiznet5k/internet/dhcp/dhcp.c
Normal file
979
drivers/wiznet5k/internet/dhcp/dhcp.c
Normal file
@ -0,0 +1,979 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \file dhcp.c
|
||||
//! \brief DHCP APIs implement file.
|
||||
//! \details Processig DHCP protocol as DISCOVER, OFFER, REQUEST, ACK, NACK and DECLINE.
|
||||
//! \version 1.1.0
|
||||
//! \date 2013/11/18
|
||||
//! \par Revision history
|
||||
//! <2018/10/09> Modified by Nick Moore for CircuitPython
|
||||
//! <2013/11/18> 1st Release
|
||||
//! <2012/12/20> V1.1.0
|
||||
//! 1. Optimize code
|
||||
//! 2. Add reg_dhcp_cbfunc()
|
||||
//! 3. Add DHCP_stop()
|
||||
//! 4. Integrate check_DHCP_state() & DHCP_run() to DHCP_run()
|
||||
//! 5. Don't care system endian
|
||||
//! 6. Add comments
|
||||
//! <2012/12/26> V1.1.1
|
||||
//! 1. Modify variable declaration: dhcp_tick_1s is declared volatile for code optimization
|
||||
//! \author Eric Jung & MidnightCow
|
||||
//! \copyright
|
||||
//!
|
||||
//! Copyright (c) 2013, WIZnet Co., LTD.
|
||||
//! All rights reserved.
|
||||
//!
|
||||
//! Redistribution and use in source and binary forms, with or without
|
||||
//! modification, are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * Redistributions of source code must retain the above copyright
|
||||
//! notice, this list of conditions and the following disclaimer.
|
||||
//! * 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.
|
||||
//! * Neither the name of the <ORGANIZATION> nor the names of its
|
||||
//! contributors may be used to endorse or promote products derived
|
||||
//! from this software without specific prior written permission.
|
||||
//!
|
||||
//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 "Ethernet/socket.h"
|
||||
//#include "Internet/DHCP/dhcp.h"
|
||||
#include "../../ethernet/socket.h"
|
||||
#include "dhcp.h"
|
||||
|
||||
/* If you want to display debug & processing message, Define _DHCP_DEBUG_ in dhcp.h */
|
||||
|
||||
#ifdef _DHCP_DEBUG_
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
/* DHCP state machine. */
|
||||
#define STATE_DHCP_INIT 0 ///< Initialize
|
||||
#define STATE_DHCP_DISCOVER 1 ///< send DISCOVER and wait OFFER
|
||||
#define STATE_DHCP_REQUEST 2 ///< send REQEUST and wait ACK or NACK
|
||||
#define STATE_DHCP_LEASED 3 ///< ReceiveD ACK and IP leased
|
||||
#define STATE_DHCP_REREQUEST 4 ///< send REQUEST for maintaining leased IP
|
||||
#define STATE_DHCP_RELEASE 5 ///< No use
|
||||
#define STATE_DHCP_STOP 6 ///< Stop processing DHCP
|
||||
|
||||
#define DHCP_FLAGSBROADCAST 0x8000 ///< The broadcast value of flags in @ref RIP_MSG
|
||||
#define DHCP_FLAGSUNICAST 0x0000 ///< The unicast value of flags in @ref RIP_MSG
|
||||
|
||||
/* DHCP message OP code */
|
||||
#define DHCP_BOOTREQUEST 1 ///< Request Message used in op of @ref RIP_MSG
|
||||
#define DHCP_BOOTREPLY 2 ///< Reply Message used i op of @ref RIP_MSG
|
||||
|
||||
/* DHCP message type */
|
||||
#define DHCP_DISCOVER 1 ///< DISCOVER message in OPT of @ref RIP_MSG
|
||||
#define DHCP_OFFER 2 ///< OFFER message in OPT of @ref RIP_MSG
|
||||
#define DHCP_REQUEST 3 ///< REQUEST message in OPT of @ref RIP_MSG
|
||||
#define DHCP_DECLINE 4 ///< DECLINE message in OPT of @ref RIP_MSG
|
||||
#define DHCP_ACK 5 ///< ACK message in OPT of @ref RIP_MSG
|
||||
#define DHCP_NAK 6 ///< NACK message in OPT of @ref RIP_MSG
|
||||
#define DHCP_RELEASE 7 ///< RELEASE message in OPT of @ref RIP_MSG. No use
|
||||
#define DHCP_INFORM 8 ///< INFORM message in OPT of @ref RIP_MSG. No use
|
||||
|
||||
#define DHCP_HTYPE10MB 1 ///< Used in type of @ref RIP_MSG
|
||||
#define DHCP_HTYPE100MB 2 ///< Used in type of @ref RIP_MSG
|
||||
|
||||
#define DHCP_HLENETHERNET 6 ///< Used in hlen of @ref RIP_MSG
|
||||
#define DHCP_HOPS 0 ///< Used in hops of @ref RIP_MSG
|
||||
#define DHCP_SECS 0 ///< Used in secs of @ref RIP_MSG
|
||||
|
||||
#define INFINITE_LEASETIME 0xffffffff ///< Infinite lease time
|
||||
|
||||
#define OPT_SIZE 312 /// Max OPT size of @ref RIP_MSG
|
||||
#define RIP_MSG_SIZE (236+OPT_SIZE) /// Max size of @ref RIP_MSG
|
||||
|
||||
/*
|
||||
* @brief DHCP option and value (cf. RFC1533)
|
||||
*/
|
||||
enum
|
||||
{
|
||||
padOption = 0,
|
||||
subnetMask = 1,
|
||||
timerOffset = 2,
|
||||
routersOnSubnet = 3,
|
||||
timeServer = 4,
|
||||
nameServer = 5,
|
||||
dns = 6,
|
||||
logServer = 7,
|
||||
cookieServer = 8,
|
||||
lprServer = 9,
|
||||
impressServer = 10,
|
||||
resourceLocationServer = 11,
|
||||
hostName = 12,
|
||||
bootFileSize = 13,
|
||||
meritDumpFile = 14,
|
||||
domainName = 15,
|
||||
swapServer = 16,
|
||||
rootPath = 17,
|
||||
extentionsPath = 18,
|
||||
IPforwarding = 19,
|
||||
nonLocalSourceRouting = 20,
|
||||
policyFilter = 21,
|
||||
maxDgramReasmSize = 22,
|
||||
defaultIPTTL = 23,
|
||||
pathMTUagingTimeout = 24,
|
||||
pathMTUplateauTable = 25,
|
||||
ifMTU = 26,
|
||||
allSubnetsLocal = 27,
|
||||
broadcastAddr = 28,
|
||||
performMaskDiscovery = 29,
|
||||
maskSupplier = 30,
|
||||
performRouterDiscovery = 31,
|
||||
routerSolicitationAddr = 32,
|
||||
staticRoute = 33,
|
||||
trailerEncapsulation = 34,
|
||||
arpCacheTimeout = 35,
|
||||
ethernetEncapsulation = 36,
|
||||
tcpDefaultTTL = 37,
|
||||
tcpKeepaliveInterval = 38,
|
||||
tcpKeepaliveGarbage = 39,
|
||||
nisDomainName = 40,
|
||||
nisServers = 41,
|
||||
ntpServers = 42,
|
||||
vendorSpecificInfo = 43,
|
||||
netBIOSnameServer = 44,
|
||||
netBIOSdgramDistServer = 45,
|
||||
netBIOSnodeType = 46,
|
||||
netBIOSscope = 47,
|
||||
xFontServer = 48,
|
||||
xDisplayManager = 49,
|
||||
dhcpRequestedIPaddr = 50,
|
||||
dhcpIPaddrLeaseTime = 51,
|
||||
dhcpOptionOverload = 52,
|
||||
dhcpMessageType = 53,
|
||||
dhcpServerIdentifier = 54,
|
||||
dhcpParamRequest = 55,
|
||||
dhcpMsg = 56,
|
||||
dhcpMaxMsgSize = 57,
|
||||
dhcpT1value = 58,
|
||||
dhcpT2value = 59,
|
||||
dhcpClassIdentifier = 60,
|
||||
dhcpClientIdentifier = 61,
|
||||
endOption = 255
|
||||
};
|
||||
|
||||
/*
|
||||
* @brief DHCP message format
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t op; ///< @ref DHCP_BOOTREQUEST or @ref DHCP_BOOTREPLY
|
||||
uint8_t htype; ///< @ref DHCP_HTYPE10MB or @ref DHCP_HTYPE100MB
|
||||
uint8_t hlen; ///< @ref DHCP_HLENETHERNET
|
||||
uint8_t hops; ///< @ref DHCP_HOPS
|
||||
uint32_t xid; ///< @ref DHCP_XID This increase one every DHCP transaction.
|
||||
uint16_t secs; ///< @ref DHCP_SECS
|
||||
uint16_t flags; ///< @ref DHCP_FLAGSBROADCAST or @ref DHCP_FLAGSUNICAST
|
||||
uint8_t ciaddr[4]; ///< @ref Request IP to DHCP sever
|
||||
uint8_t yiaddr[4]; ///< @ref Offered IP from DHCP server
|
||||
uint8_t siaddr[4]; ///< No use
|
||||
uint8_t giaddr[4]; ///< No use
|
||||
uint8_t chaddr[16]; ///< DHCP client 6bytes MAC address. Others is filled to zero
|
||||
uint8_t sname[64]; ///< No use
|
||||
uint8_t file[128]; ///< No use
|
||||
uint8_t OPT[OPT_SIZE]; ///< Option
|
||||
} RIP_MSG;
|
||||
|
||||
|
||||
|
||||
uint8_t DHCP_SOCKET; // Socket number for DHCP
|
||||
|
||||
uint8_t DHCP_SIP[4]; // DHCP Server IP address
|
||||
|
||||
// Network information from DHCP Server
|
||||
uint8_t OLD_allocated_ip[4] = {0, }; // Previous IP address
|
||||
uint8_t DHCP_allocated_ip[4] = {0, }; // IP address from DHCP
|
||||
uint8_t DHCP_allocated_gw[4] = {0, }; // Gateway address from DHCP
|
||||
uint8_t DHCP_allocated_sn[4] = {0, }; // Subnet mask from DHCP
|
||||
uint8_t DHCP_allocated_dns[4] = {0, }; // DNS address from DHCP
|
||||
|
||||
|
||||
int8_t dhcp_state = STATE_DHCP_INIT; // DHCP state
|
||||
int8_t dhcp_retry_count = 0;
|
||||
|
||||
uint32_t dhcp_lease_time = INFINITE_LEASETIME;
|
||||
volatile uint32_t dhcp_tick_1s = 0; // unit 1 second
|
||||
uint32_t dhcp_tick_next = DHCP_WAIT_TIME ;
|
||||
|
||||
uint32_t DHCP_XID; // Any number
|
||||
|
||||
RIP_MSG* pDHCPMSG; // Buffer pointer for DHCP processing
|
||||
|
||||
uint8_t HOST_NAME[] = DCHP_HOST_NAME;
|
||||
|
||||
uint8_t DHCP_CHADDR[6]; // DHCP Client MAC address.
|
||||
|
||||
/* The default callback function */
|
||||
void default_ip_assign(void);
|
||||
void default_ip_update(void);
|
||||
void default_ip_conflict(void);
|
||||
|
||||
/* Callback handler */
|
||||
void (*dhcp_ip_assign)(void) = default_ip_assign; /* handler to be called when the IP address from DHCP server is first assigned */
|
||||
void (*dhcp_ip_update)(void) = default_ip_update; /* handler to be called when the IP address from DHCP server is updated */
|
||||
void (*dhcp_ip_conflict)(void) = default_ip_conflict; /* handler to be called when the IP address from DHCP server is conflict */
|
||||
|
||||
void reg_dhcp_cbfunc(void(*ip_assign)(void), void(*ip_update)(void), void(*ip_conflict)(void));
|
||||
|
||||
|
||||
/* send DISCOVER message to DHCP server */
|
||||
void send_DHCP_DISCOVER(void);
|
||||
|
||||
/* send REQEUST message to DHCP server */
|
||||
void send_DHCP_REQUEST(void);
|
||||
|
||||
/* send DECLINE message to DHCP server */
|
||||
void send_DHCP_DECLINE(void);
|
||||
|
||||
/* IP conflict check by sending ARP-request to leased IP and wait ARP-response. */
|
||||
int8_t check_DHCP_leasedIP(void);
|
||||
|
||||
/* check the timeout in DHCP process */
|
||||
uint8_t check_DHCP_timeout(void);
|
||||
|
||||
/* Intialize to timeout process. */
|
||||
void reset_DHCP_timeout(void);
|
||||
|
||||
/* Parse message as OFFER and ACK and NACK from DHCP server.*/
|
||||
int8_t parseDHCPCMSG(void);
|
||||
|
||||
/* The default handler of ip assign first */
|
||||
void default_ip_assign(void)
|
||||
{
|
||||
setSIPR(DHCP_allocated_ip);
|
||||
setSUBR(DHCP_allocated_sn);
|
||||
setGAR (DHCP_allocated_gw);
|
||||
}
|
||||
|
||||
/* The default handler of ip changed */
|
||||
void default_ip_update(void)
|
||||
{
|
||||
/* WIZchip Software Reset */
|
||||
setMR(MR_RST);
|
||||
getMR(); // for delay
|
||||
default_ip_assign();
|
||||
setSHAR(DHCP_CHADDR);
|
||||
}
|
||||
|
||||
/* The default handler of ip changed */
|
||||
void default_ip_conflict(void)
|
||||
{
|
||||
// WIZchip Software Reset
|
||||
setMR(MR_RST);
|
||||
getMR(); // for delay
|
||||
setSHAR(DHCP_CHADDR);
|
||||
}
|
||||
|
||||
/* register the call back func. */
|
||||
void reg_dhcp_cbfunc(void(*ip_assign)(void), void(*ip_update)(void), void(*ip_conflict)(void))
|
||||
{
|
||||
dhcp_ip_assign = default_ip_assign;
|
||||
dhcp_ip_update = default_ip_update;
|
||||
dhcp_ip_conflict = default_ip_conflict;
|
||||
if(ip_assign) dhcp_ip_assign = ip_assign;
|
||||
if(ip_update) dhcp_ip_update = ip_update;
|
||||
if(ip_conflict) dhcp_ip_conflict = ip_conflict;
|
||||
}
|
||||
|
||||
/* make the common DHCP message */
|
||||
void makeDHCPMSG(void)
|
||||
{
|
||||
uint8_t bk_mac[6];
|
||||
uint8_t* ptmp;
|
||||
uint8_t i;
|
||||
getSHAR(bk_mac);
|
||||
pDHCPMSG->op = DHCP_BOOTREQUEST;
|
||||
pDHCPMSG->htype = DHCP_HTYPE10MB;
|
||||
pDHCPMSG->hlen = DHCP_HLENETHERNET;
|
||||
pDHCPMSG->hops = DHCP_HOPS;
|
||||
ptmp = (uint8_t*)(&pDHCPMSG->xid);
|
||||
*(ptmp+0) = (uint8_t)((DHCP_XID & 0xFF000000) >> 24);
|
||||
*(ptmp+1) = (uint8_t)((DHCP_XID & 0x00FF0000) >> 16);
|
||||
*(ptmp+2) = (uint8_t)((DHCP_XID & 0x0000FF00) >> 8);
|
||||
*(ptmp+3) = (uint8_t)((DHCP_XID & 0x000000FF) >> 0);
|
||||
pDHCPMSG->secs = DHCP_SECS;
|
||||
ptmp = (uint8_t*)(&pDHCPMSG->flags);
|
||||
*(ptmp+0) = (uint8_t)((DHCP_FLAGSBROADCAST & 0xFF00) >> 8);
|
||||
*(ptmp+1) = (uint8_t)((DHCP_FLAGSBROADCAST & 0x00FF) >> 0);
|
||||
|
||||
pDHCPMSG->ciaddr[0] = 0;
|
||||
pDHCPMSG->ciaddr[1] = 0;
|
||||
pDHCPMSG->ciaddr[2] = 0;
|
||||
pDHCPMSG->ciaddr[3] = 0;
|
||||
|
||||
pDHCPMSG->yiaddr[0] = 0;
|
||||
pDHCPMSG->yiaddr[1] = 0;
|
||||
pDHCPMSG->yiaddr[2] = 0;
|
||||
pDHCPMSG->yiaddr[3] = 0;
|
||||
|
||||
pDHCPMSG->siaddr[0] = 0;
|
||||
pDHCPMSG->siaddr[1] = 0;
|
||||
pDHCPMSG->siaddr[2] = 0;
|
||||
pDHCPMSG->siaddr[3] = 0;
|
||||
|
||||
pDHCPMSG->giaddr[0] = 0;
|
||||
pDHCPMSG->giaddr[1] = 0;
|
||||
pDHCPMSG->giaddr[2] = 0;
|
||||
pDHCPMSG->giaddr[3] = 0;
|
||||
|
||||
pDHCPMSG->chaddr[0] = DHCP_CHADDR[0];
|
||||
pDHCPMSG->chaddr[1] = DHCP_CHADDR[1];
|
||||
pDHCPMSG->chaddr[2] = DHCP_CHADDR[2];
|
||||
pDHCPMSG->chaddr[3] = DHCP_CHADDR[3];
|
||||
pDHCPMSG->chaddr[4] = DHCP_CHADDR[4];
|
||||
pDHCPMSG->chaddr[5] = DHCP_CHADDR[5];
|
||||
|
||||
for (i = 6; i < 16; i++) pDHCPMSG->chaddr[i] = 0;
|
||||
for (i = 0; i < 64; i++) pDHCPMSG->sname[i] = 0;
|
||||
for (i = 0; i < 128; i++) pDHCPMSG->file[i] = 0;
|
||||
|
||||
// MAGIC_COOKIE
|
||||
pDHCPMSG->OPT[0] = (uint8_t)((MAGIC_COOKIE & 0xFF000000) >> 24);
|
||||
pDHCPMSG->OPT[1] = (uint8_t)((MAGIC_COOKIE & 0x00FF0000) >> 16);
|
||||
pDHCPMSG->OPT[2] = (uint8_t)((MAGIC_COOKIE & 0x0000FF00) >> 8);
|
||||
pDHCPMSG->OPT[3] = (uint8_t) (MAGIC_COOKIE & 0x000000FF) >> 0;
|
||||
}
|
||||
|
||||
/* SEND DHCP DISCOVER */
|
||||
void send_DHCP_DISCOVER(void)
|
||||
{
|
||||
uint16_t i;
|
||||
uint8_t ip[4];
|
||||
uint16_t k = 0;
|
||||
|
||||
makeDHCPMSG();
|
||||
|
||||
k = 4; // because MAGIC_COOKIE already made by makeDHCPMSG()
|
||||
|
||||
// Option Request Param
|
||||
pDHCPMSG->OPT[k++] = dhcpMessageType;
|
||||
pDHCPMSG->OPT[k++] = 0x01;
|
||||
pDHCPMSG->OPT[k++] = DHCP_DISCOVER;
|
||||
|
||||
// Client identifier
|
||||
pDHCPMSG->OPT[k++] = dhcpClientIdentifier;
|
||||
pDHCPMSG->OPT[k++] = 0x07;
|
||||
pDHCPMSG->OPT[k++] = 0x01;
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[0];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[1];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[2];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[3];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[4];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[5];
|
||||
|
||||
// host name
|
||||
pDHCPMSG->OPT[k++] = hostName;
|
||||
pDHCPMSG->OPT[k++] = 0; // fill zero length of hostname
|
||||
for(i = 0 ; HOST_NAME[i] != 0; i++)
|
||||
pDHCPMSG->OPT[k++] = HOST_NAME[i];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[3];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[4];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[5];
|
||||
pDHCPMSG->OPT[k - (i+3+1)] = i+3; // length of hostname
|
||||
|
||||
pDHCPMSG->OPT[k++] = dhcpParamRequest;
|
||||
pDHCPMSG->OPT[k++] = 0x06; // length of request
|
||||
pDHCPMSG->OPT[k++] = subnetMask;
|
||||
pDHCPMSG->OPT[k++] = routersOnSubnet;
|
||||
pDHCPMSG->OPT[k++] = dns;
|
||||
pDHCPMSG->OPT[k++] = domainName;
|
||||
pDHCPMSG->OPT[k++] = dhcpT1value;
|
||||
pDHCPMSG->OPT[k++] = dhcpT2value;
|
||||
pDHCPMSG->OPT[k++] = endOption;
|
||||
|
||||
for (i = k; i < OPT_SIZE; i++) pDHCPMSG->OPT[i] = 0;
|
||||
|
||||
// send broadcasting packet
|
||||
ip[0] = 255;
|
||||
ip[1] = 255;
|
||||
ip[2] = 255;
|
||||
ip[3] = 255;
|
||||
|
||||
#ifdef _DHCP_DEBUG_
|
||||
printf("> Send DHCP_DISCOVER\r\n");
|
||||
#endif
|
||||
|
||||
WIZCHIP_EXPORT(sendto)(DHCP_SOCKET, (uint8_t *)pDHCPMSG, RIP_MSG_SIZE, ip, DHCP_SERVER_PORT);
|
||||
}
|
||||
|
||||
/* SEND DHCP REQUEST */
|
||||
void send_DHCP_REQUEST(void)
|
||||
{
|
||||
int i;
|
||||
uint8_t ip[4];
|
||||
uint16_t k = 0;
|
||||
|
||||
makeDHCPMSG();
|
||||
|
||||
if(dhcp_state == STATE_DHCP_LEASED || dhcp_state == STATE_DHCP_REREQUEST)
|
||||
{
|
||||
*((uint8_t*)(&pDHCPMSG->flags)) = ((DHCP_FLAGSUNICAST & 0xFF00)>> 8);
|
||||
*((uint8_t*)(&pDHCPMSG->flags)+1) = (DHCP_FLAGSUNICAST & 0x00FF);
|
||||
pDHCPMSG->ciaddr[0] = DHCP_allocated_ip[0];
|
||||
pDHCPMSG->ciaddr[1] = DHCP_allocated_ip[1];
|
||||
pDHCPMSG->ciaddr[2] = DHCP_allocated_ip[2];
|
||||
pDHCPMSG->ciaddr[3] = DHCP_allocated_ip[3];
|
||||
ip[0] = DHCP_SIP[0];
|
||||
ip[1] = DHCP_SIP[1];
|
||||
ip[2] = DHCP_SIP[2];
|
||||
ip[3] = DHCP_SIP[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
ip[0] = 255;
|
||||
ip[1] = 255;
|
||||
ip[2] = 255;
|
||||
ip[3] = 255;
|
||||
}
|
||||
|
||||
k = 4; // because MAGIC_COOKIE already made by makeDHCPMSG()
|
||||
|
||||
// Option Request Param.
|
||||
pDHCPMSG->OPT[k++] = dhcpMessageType;
|
||||
pDHCPMSG->OPT[k++] = 0x01;
|
||||
pDHCPMSG->OPT[k++] = DHCP_REQUEST;
|
||||
|
||||
pDHCPMSG->OPT[k++] = dhcpClientIdentifier;
|
||||
pDHCPMSG->OPT[k++] = 0x07;
|
||||
pDHCPMSG->OPT[k++] = 0x01;
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[0];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[1];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[2];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[3];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[4];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[5];
|
||||
|
||||
if(ip[3] == 255) // if(dchp_state == STATE_DHCP_LEASED || dchp_state == DHCP_REREQUEST_STATE)
|
||||
{
|
||||
pDHCPMSG->OPT[k++] = dhcpRequestedIPaddr;
|
||||
pDHCPMSG->OPT[k++] = 0x04;
|
||||
pDHCPMSG->OPT[k++] = DHCP_allocated_ip[0];
|
||||
pDHCPMSG->OPT[k++] = DHCP_allocated_ip[1];
|
||||
pDHCPMSG->OPT[k++] = DHCP_allocated_ip[2];
|
||||
pDHCPMSG->OPT[k++] = DHCP_allocated_ip[3];
|
||||
|
||||
pDHCPMSG->OPT[k++] = dhcpServerIdentifier;
|
||||
pDHCPMSG->OPT[k++] = 0x04;
|
||||
pDHCPMSG->OPT[k++] = DHCP_SIP[0];
|
||||
pDHCPMSG->OPT[k++] = DHCP_SIP[1];
|
||||
pDHCPMSG->OPT[k++] = DHCP_SIP[2];
|
||||
pDHCPMSG->OPT[k++] = DHCP_SIP[3];
|
||||
}
|
||||
|
||||
// host name
|
||||
pDHCPMSG->OPT[k++] = hostName;
|
||||
pDHCPMSG->OPT[k++] = 0; // length of hostname
|
||||
for(i = 0 ; HOST_NAME[i] != 0; i++)
|
||||
pDHCPMSG->OPT[k++] = HOST_NAME[i];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[3];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[4];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[5];
|
||||
pDHCPMSG->OPT[k - (i+3+1)] = i+3; // length of hostname
|
||||
|
||||
pDHCPMSG->OPT[k++] = dhcpParamRequest;
|
||||
pDHCPMSG->OPT[k++] = 0x08;
|
||||
pDHCPMSG->OPT[k++] = subnetMask;
|
||||
pDHCPMSG->OPT[k++] = routersOnSubnet;
|
||||
pDHCPMSG->OPT[k++] = dns;
|
||||
pDHCPMSG->OPT[k++] = domainName;
|
||||
pDHCPMSG->OPT[k++] = dhcpT1value;
|
||||
pDHCPMSG->OPT[k++] = dhcpT2value;
|
||||
pDHCPMSG->OPT[k++] = performRouterDiscovery;
|
||||
pDHCPMSG->OPT[k++] = staticRoute;
|
||||
pDHCPMSG->OPT[k++] = endOption;
|
||||
|
||||
for (i = k; i < OPT_SIZE; i++) pDHCPMSG->OPT[i] = 0;
|
||||
|
||||
#ifdef _DHCP_DEBUG_
|
||||
printf("> Send DHCP_REQUEST\r\n");
|
||||
#endif
|
||||
|
||||
WIZCHIP_EXPORT(sendto)(DHCP_SOCKET, (uint8_t *)pDHCPMSG, RIP_MSG_SIZE, ip, DHCP_SERVER_PORT);
|
||||
|
||||
}
|
||||
|
||||
/* SEND DHCP DHCPDECLINE */
|
||||
void send_DHCP_DECLINE(void)
|
||||
{
|
||||
int i;
|
||||
uint8_t ip[4];
|
||||
uint16_t k = 0;
|
||||
|
||||
makeDHCPMSG();
|
||||
|
||||
k = 4; // because MAGIC_COOKIE already made by makeDHCPMSG()
|
||||
|
||||
*((uint8_t*)(&pDHCPMSG->flags)) = ((DHCP_FLAGSUNICAST & 0xFF00)>> 8);
|
||||
*((uint8_t*)(&pDHCPMSG->flags)+1) = (DHCP_FLAGSUNICAST & 0x00FF);
|
||||
|
||||
// Option Request Param.
|
||||
pDHCPMSG->OPT[k++] = dhcpMessageType;
|
||||
pDHCPMSG->OPT[k++] = 0x01;
|
||||
pDHCPMSG->OPT[k++] = DHCP_DECLINE;
|
||||
|
||||
pDHCPMSG->OPT[k++] = dhcpClientIdentifier;
|
||||
pDHCPMSG->OPT[k++] = 0x07;
|
||||
pDHCPMSG->OPT[k++] = 0x01;
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[0];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[1];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[2];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[3];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[4];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[5];
|
||||
|
||||
pDHCPMSG->OPT[k++] = dhcpRequestedIPaddr;
|
||||
pDHCPMSG->OPT[k++] = 0x04;
|
||||
pDHCPMSG->OPT[k++] = DHCP_allocated_ip[0];
|
||||
pDHCPMSG->OPT[k++] = DHCP_allocated_ip[1];
|
||||
pDHCPMSG->OPT[k++] = DHCP_allocated_ip[2];
|
||||
pDHCPMSG->OPT[k++] = DHCP_allocated_ip[3];
|
||||
|
||||
pDHCPMSG->OPT[k++] = dhcpServerIdentifier;
|
||||
pDHCPMSG->OPT[k++] = 0x04;
|
||||
pDHCPMSG->OPT[k++] = DHCP_SIP[0];
|
||||
pDHCPMSG->OPT[k++] = DHCP_SIP[1];
|
||||
pDHCPMSG->OPT[k++] = DHCP_SIP[2];
|
||||
pDHCPMSG->OPT[k++] = DHCP_SIP[3];
|
||||
|
||||
pDHCPMSG->OPT[k++] = endOption;
|
||||
|
||||
for (i = k; i < OPT_SIZE; i++) pDHCPMSG->OPT[i] = 0;
|
||||
|
||||
//send broadcasting packet
|
||||
ip[0] = 0xFF;
|
||||
ip[1] = 0xFF;
|
||||
ip[2] = 0xFF;
|
||||
ip[3] = 0xFF;
|
||||
|
||||
#ifdef _DHCP_DEBUG_
|
||||
printf("\r\n> Send DHCP_DECLINE\r\n");
|
||||
#endif
|
||||
|
||||
WIZCHIP_EXPORT(sendto)(DHCP_SOCKET, (uint8_t *)pDHCPMSG, RIP_MSG_SIZE, ip, DHCP_SERVER_PORT);
|
||||
}
|
||||
|
||||
/* PARSE REPLY pDHCPMSG */
|
||||
int8_t parseDHCPMSG(void)
|
||||
{
|
||||
uint8_t svr_addr[6];
|
||||
uint16_t svr_port;
|
||||
uint16_t len;
|
||||
|
||||
uint8_t * p;
|
||||
uint8_t * e;
|
||||
uint8_t type;
|
||||
uint8_t opt_len;
|
||||
|
||||
if((len = getSn_RX_RSR(DHCP_SOCKET)) > 0)
|
||||
{
|
||||
len = WIZCHIP_EXPORT(recvfrom)(DHCP_SOCKET, (uint8_t *)pDHCPMSG, len, svr_addr, &svr_port);
|
||||
#ifdef _DHCP_DEBUG_
|
||||
printf("DHCP message : %d.%d.%d.%d(%d) %d received. \r\n",svr_addr[0],svr_addr[1],svr_addr[2], svr_addr[3],svr_port, len);
|
||||
#endif
|
||||
}
|
||||
else return 0;
|
||||
if (svr_port == DHCP_SERVER_PORT) {
|
||||
// compare mac address
|
||||
if ( (pDHCPMSG->chaddr[0] != DHCP_CHADDR[0]) || (pDHCPMSG->chaddr[1] != DHCP_CHADDR[1]) ||
|
||||
(pDHCPMSG->chaddr[2] != DHCP_CHADDR[2]) || (pDHCPMSG->chaddr[3] != DHCP_CHADDR[3]) ||
|
||||
(pDHCPMSG->chaddr[4] != DHCP_CHADDR[4]) || (pDHCPMSG->chaddr[5] != DHCP_CHADDR[5]) )
|
||||
return 0;
|
||||
type = 0;
|
||||
p = (uint8_t *)(&pDHCPMSG->op);
|
||||
p = p + 240; // 240 = sizeof(RIP_MSG) + MAGIC_COOKIE size in RIP_MSG.opt - sizeof(RIP_MSG.opt)
|
||||
e = p + (len - 240);
|
||||
|
||||
while ( p < e ) {
|
||||
|
||||
switch ( *p ) {
|
||||
|
||||
case endOption :
|
||||
p = e; // for break while(p < e)
|
||||
break;
|
||||
case padOption :
|
||||
p++;
|
||||
break;
|
||||
case dhcpMessageType :
|
||||
p++;
|
||||
p++;
|
||||
type = *p++;
|
||||
break;
|
||||
case subnetMask :
|
||||
p++;
|
||||
p++;
|
||||
DHCP_allocated_sn[0] = *p++;
|
||||
DHCP_allocated_sn[1] = *p++;
|
||||
DHCP_allocated_sn[2] = *p++;
|
||||
DHCP_allocated_sn[3] = *p++;
|
||||
break;
|
||||
case routersOnSubnet :
|
||||
p++;
|
||||
opt_len = *p++;
|
||||
DHCP_allocated_gw[0] = *p++;
|
||||
DHCP_allocated_gw[1] = *p++;
|
||||
DHCP_allocated_gw[2] = *p++;
|
||||
DHCP_allocated_gw[3] = *p++;
|
||||
p = p + (opt_len - 4);
|
||||
break;
|
||||
case dns :
|
||||
p++;
|
||||
opt_len = *p++;
|
||||
DHCP_allocated_dns[0] = *p++;
|
||||
DHCP_allocated_dns[1] = *p++;
|
||||
DHCP_allocated_dns[2] = *p++;
|
||||
DHCP_allocated_dns[3] = *p++;
|
||||
p = p + (opt_len - 4);
|
||||
break;
|
||||
case dhcpIPaddrLeaseTime :
|
||||
p++;
|
||||
opt_len = *p++;
|
||||
dhcp_lease_time = *p++;
|
||||
dhcp_lease_time = (dhcp_lease_time << 8) + *p++;
|
||||
dhcp_lease_time = (dhcp_lease_time << 8) + *p++;
|
||||
dhcp_lease_time = (dhcp_lease_time << 8) + *p++;
|
||||
#ifdef _DHCP_DEBUG_
|
||||
dhcp_lease_time = 10;
|
||||
#endif
|
||||
break;
|
||||
case dhcpServerIdentifier :
|
||||
p++;
|
||||
opt_len = *p++;
|
||||
DHCP_SIP[0] = *p++;
|
||||
DHCP_SIP[1] = *p++;
|
||||
DHCP_SIP[2] = *p++;
|
||||
DHCP_SIP[3] = *p++;
|
||||
break;
|
||||
default :
|
||||
p++;
|
||||
opt_len = *p++;
|
||||
p += opt_len;
|
||||
break;
|
||||
} // switch
|
||||
} // while
|
||||
} // if
|
||||
return type;
|
||||
}
|
||||
|
||||
uint8_t DHCP_run(void)
|
||||
{
|
||||
uint8_t type;
|
||||
uint8_t ret;
|
||||
|
||||
if(dhcp_state == STATE_DHCP_STOP) return DHCP_STOPPED;
|
||||
|
||||
if(getSn_SR(DHCP_SOCKET) != SOCK_UDP)
|
||||
WIZCHIP_EXPORT(socket)(DHCP_SOCKET, Sn_MR_UDP, DHCP_CLIENT_PORT, 0x00);
|
||||
|
||||
ret = DHCP_RUNNING;
|
||||
type = parseDHCPMSG();
|
||||
|
||||
switch ( dhcp_state ) {
|
||||
case STATE_DHCP_INIT :
|
||||
DHCP_allocated_ip[0] = 0;
|
||||
DHCP_allocated_ip[1] = 0;
|
||||
DHCP_allocated_ip[2] = 0;
|
||||
DHCP_allocated_ip[3] = 0;
|
||||
send_DHCP_DISCOVER();
|
||||
dhcp_state = STATE_DHCP_DISCOVER;
|
||||
break;
|
||||
case STATE_DHCP_DISCOVER :
|
||||
if (type == DHCP_OFFER){
|
||||
#ifdef _DHCP_DEBUG_
|
||||
printf("> Receive DHCP_OFFER\r\n");
|
||||
#endif
|
||||
DHCP_allocated_ip[0] = pDHCPMSG->yiaddr[0];
|
||||
DHCP_allocated_ip[1] = pDHCPMSG->yiaddr[1];
|
||||
DHCP_allocated_ip[2] = pDHCPMSG->yiaddr[2];
|
||||
DHCP_allocated_ip[3] = pDHCPMSG->yiaddr[3];
|
||||
|
||||
send_DHCP_REQUEST();
|
||||
dhcp_state = STATE_DHCP_REQUEST;
|
||||
} else ret = check_DHCP_timeout();
|
||||
break;
|
||||
|
||||
case STATE_DHCP_REQUEST :
|
||||
if (type == DHCP_ACK) {
|
||||
|
||||
#ifdef _DHCP_DEBUG_
|
||||
printf("> Receive DHCP_ACK\r\n");
|
||||
#endif
|
||||
if (check_DHCP_leasedIP()) {
|
||||
// Network info assignment from DHCP
|
||||
dhcp_ip_assign();
|
||||
reset_DHCP_timeout();
|
||||
|
||||
dhcp_state = STATE_DHCP_LEASED;
|
||||
} else {
|
||||
// IP address conflict occurred
|
||||
reset_DHCP_timeout();
|
||||
dhcp_ip_conflict();
|
||||
dhcp_state = STATE_DHCP_INIT;
|
||||
}
|
||||
} else if (type == DHCP_NAK) {
|
||||
|
||||
#ifdef _DHCP_DEBUG_
|
||||
printf("> Receive DHCP_NACK\r\n");
|
||||
#endif
|
||||
|
||||
reset_DHCP_timeout();
|
||||
|
||||
dhcp_state = STATE_DHCP_DISCOVER;
|
||||
} else ret = check_DHCP_timeout();
|
||||
break;
|
||||
|
||||
case STATE_DHCP_LEASED :
|
||||
ret = DHCP_IP_LEASED;
|
||||
if ((dhcp_lease_time != INFINITE_LEASETIME) && ((dhcp_lease_time/2) < dhcp_tick_1s)) {
|
||||
|
||||
#ifdef _DHCP_DEBUG_
|
||||
printf("> Maintains the IP address \r\n");
|
||||
#endif
|
||||
|
||||
type = 0;
|
||||
OLD_allocated_ip[0] = DHCP_allocated_ip[0];
|
||||
OLD_allocated_ip[1] = DHCP_allocated_ip[1];
|
||||
OLD_allocated_ip[2] = DHCP_allocated_ip[2];
|
||||
OLD_allocated_ip[3] = DHCP_allocated_ip[3];
|
||||
|
||||
DHCP_XID++;
|
||||
|
||||
send_DHCP_REQUEST();
|
||||
|
||||
reset_DHCP_timeout();
|
||||
|
||||
dhcp_state = STATE_DHCP_REREQUEST;
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_DHCP_REREQUEST :
|
||||
ret = DHCP_IP_LEASED;
|
||||
if (type == DHCP_ACK) {
|
||||
dhcp_retry_count = 0;
|
||||
if (OLD_allocated_ip[0] != DHCP_allocated_ip[0] ||
|
||||
OLD_allocated_ip[1] != DHCP_allocated_ip[1] ||
|
||||
OLD_allocated_ip[2] != DHCP_allocated_ip[2] ||
|
||||
OLD_allocated_ip[3] != DHCP_allocated_ip[3])
|
||||
{
|
||||
ret = DHCP_IP_CHANGED;
|
||||
dhcp_ip_update();
|
||||
#ifdef _DHCP_DEBUG_
|
||||
printf(">IP changed.\r\n");
|
||||
#endif
|
||||
|
||||
}
|
||||
#ifdef _DHCP_DEBUG_
|
||||
else printf(">IP is continued.\r\n");
|
||||
#endif
|
||||
reset_DHCP_timeout();
|
||||
dhcp_state = STATE_DHCP_LEASED;
|
||||
} else if (type == DHCP_NAK) {
|
||||
|
||||
#ifdef _DHCP_DEBUG_
|
||||
printf("> Receive DHCP_NACK, Failed to maintain ip\r\n");
|
||||
#endif
|
||||
|
||||
reset_DHCP_timeout();
|
||||
|
||||
dhcp_state = STATE_DHCP_DISCOVER;
|
||||
} else ret = check_DHCP_timeout();
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DHCP_stop(void)
|
||||
{
|
||||
WIZCHIP_EXPORT(close)(DHCP_SOCKET);
|
||||
dhcp_state = STATE_DHCP_STOP;
|
||||
}
|
||||
|
||||
uint8_t check_DHCP_timeout(void)
|
||||
{
|
||||
uint8_t ret = DHCP_RUNNING;
|
||||
|
||||
if (dhcp_retry_count < MAX_DHCP_RETRY) {
|
||||
if (dhcp_tick_next < dhcp_tick_1s) {
|
||||
|
||||
switch ( dhcp_state ) {
|
||||
case STATE_DHCP_DISCOVER :
|
||||
// printf("<<timeout>> state : STATE_DHCP_DISCOVER\r\n");
|
||||
send_DHCP_DISCOVER();
|
||||
break;
|
||||
|
||||
case STATE_DHCP_REQUEST :
|
||||
// printf("<<timeout>> state : STATE_DHCP_REQUEST\r\n");
|
||||
|
||||
send_DHCP_REQUEST();
|
||||
break;
|
||||
|
||||
case STATE_DHCP_REREQUEST :
|
||||
// printf("<<timeout>> state : STATE_DHCP_REREQUEST\r\n");
|
||||
|
||||
send_DHCP_REQUEST();
|
||||
break;
|
||||
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
dhcp_tick_1s = 0;
|
||||
dhcp_tick_next = dhcp_tick_1s + DHCP_WAIT_TIME;
|
||||
dhcp_retry_count++;
|
||||
}
|
||||
} else { // timeout occurred
|
||||
|
||||
switch(dhcp_state) {
|
||||
case STATE_DHCP_DISCOVER:
|
||||
dhcp_state = STATE_DHCP_INIT;
|
||||
ret = DHCP_FAILED;
|
||||
break;
|
||||
case STATE_DHCP_REQUEST:
|
||||
case STATE_DHCP_REREQUEST:
|
||||
send_DHCP_DISCOVER();
|
||||
dhcp_state = STATE_DHCP_DISCOVER;
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
reset_DHCP_timeout();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int8_t check_DHCP_leasedIP(void)
|
||||
{
|
||||
uint8_t tmp;
|
||||
int32_t ret;
|
||||
|
||||
//WIZchip RCR value changed for ARP Timeout count control
|
||||
tmp = getRCR();
|
||||
setRCR(0x03);
|
||||
|
||||
// IP conflict detection : ARP request - ARP reply
|
||||
// Broadcasting ARP Request for check the IP conflict using UDP sendto() function
|
||||
ret = WIZCHIP_EXPORT(sendto)(DHCP_SOCKET, (uint8_t *)"CHECK_IP_CONFLICT", 17, DHCP_allocated_ip, 5000);
|
||||
|
||||
// RCR value restore
|
||||
setRCR(tmp);
|
||||
|
||||
if(ret == SOCKERR_TIMEOUT) {
|
||||
// UDP send Timeout occurred : allocated IP address is unique, DHCP Success
|
||||
|
||||
#ifdef _DHCP_DEBUG_
|
||||
printf("\r\n> Check leased IP - OK\r\n");
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
// Received ARP reply or etc : IP address conflict occur, DHCP Failed
|
||||
send_DHCP_DECLINE();
|
||||
|
||||
ret = dhcp_tick_1s;
|
||||
while((dhcp_tick_1s - ret) < 2) ; // wait for 1s over; wait to complete to send DECLINE message;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DHCP_init(uint8_t s, DHCP_INIT_BUFFER_TYPE* buf)
|
||||
{
|
||||
uint8_t zeroip[4] = {0,0,0,0};
|
||||
getSHAR(DHCP_CHADDR);
|
||||
if((DHCP_CHADDR[0] | DHCP_CHADDR[1] | DHCP_CHADDR[2] | DHCP_CHADDR[3] | DHCP_CHADDR[4] | DHCP_CHADDR[5]) == 0x00)
|
||||
{
|
||||
// assign temporary mac address, you should be set SHAR before call this function.
|
||||
DHCP_CHADDR[0] = 0x00;
|
||||
DHCP_CHADDR[1] = 0x08;
|
||||
DHCP_CHADDR[2] = 0xdc;
|
||||
DHCP_CHADDR[3] = 0x00;
|
||||
DHCP_CHADDR[4] = 0x00;
|
||||
DHCP_CHADDR[5] = 0x00;
|
||||
setSHAR(DHCP_CHADDR);
|
||||
}
|
||||
|
||||
DHCP_SOCKET = s; // SOCK_DHCP
|
||||
pDHCPMSG = (RIP_MSG*)buf;
|
||||
DHCP_XID = 0x12345678;
|
||||
|
||||
// WIZchip Netinfo Clear
|
||||
setSIPR(zeroip);
|
||||
setSIPR(zeroip);
|
||||
setGAR(zeroip);
|
||||
|
||||
reset_DHCP_timeout();
|
||||
dhcp_state = STATE_DHCP_INIT;
|
||||
}
|
||||
|
||||
|
||||
/* Rset the DHCP timeout count and retry count. */
|
||||
void reset_DHCP_timeout(void)
|
||||
{
|
||||
dhcp_tick_1s = 0;
|
||||
dhcp_tick_next = DHCP_WAIT_TIME;
|
||||
dhcp_retry_count = 0;
|
||||
}
|
||||
|
||||
void DHCP_time_handler(void)
|
||||
{
|
||||
dhcp_tick_1s++;
|
||||
}
|
||||
|
||||
void getIPfromDHCP(uint8_t* ip)
|
||||
{
|
||||
ip[0] = DHCP_allocated_ip[0];
|
||||
ip[1] = DHCP_allocated_ip[1];
|
||||
ip[2] = DHCP_allocated_ip[2];
|
||||
ip[3] = DHCP_allocated_ip[3];
|
||||
}
|
||||
|
||||
void getGWfromDHCP(uint8_t* ip)
|
||||
{
|
||||
ip[0] =DHCP_allocated_gw[0];
|
||||
ip[1] =DHCP_allocated_gw[1];
|
||||
ip[2] =DHCP_allocated_gw[2];
|
||||
ip[3] =DHCP_allocated_gw[3];
|
||||
}
|
||||
|
||||
void getSNfromDHCP(uint8_t* ip)
|
||||
{
|
||||
ip[0] = DHCP_allocated_sn[0];
|
||||
ip[1] = DHCP_allocated_sn[1];
|
||||
ip[2] = DHCP_allocated_sn[2];
|
||||
ip[3] = DHCP_allocated_sn[3];
|
||||
}
|
||||
|
||||
void getDNSfromDHCP(uint8_t* ip)
|
||||
{
|
||||
ip[0] = DHCP_allocated_dns[0];
|
||||
ip[1] = DHCP_allocated_dns[1];
|
||||
ip[2] = DHCP_allocated_dns[2];
|
||||
ip[3] = DHCP_allocated_dns[3];
|
||||
}
|
||||
|
||||
uint32_t getDHCPLeasetime(void)
|
||||
{
|
||||
return dhcp_lease_time;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
152
drivers/wiznet5k/internet/dhcp/dhcp.h
Normal file
152
drivers/wiznet5k/internet/dhcp/dhcp.h
Normal file
@ -0,0 +1,152 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \file dhcp.h
|
||||
//! \brief DHCP APIs Header file.
|
||||
//! \details Processig DHCP protocol as DISCOVER, OFFER, REQUEST, ACK, NACK and DECLINE.
|
||||
//! \version 1.1.0
|
||||
//! \date 2013/11/18
|
||||
//! \par Revision history
|
||||
//! <2013/11/18> 1st Release
|
||||
//! <2012/12/20> V1.1.0
|
||||
//! 1. Move unreferenced DEFINE to dhcp.c
|
||||
//! <2012/12/26> V1.1.1
|
||||
//! \author Eric Jung & MidnightCow
|
||||
//! \copyright
|
||||
//!
|
||||
//! Copyright (c) 2013, WIZnet Co., LTD.
|
||||
//! All rights reserved.
|
||||
//!
|
||||
//! Redistribution and use in source and binary forms, with or without
|
||||
//! modification, are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * Redistributions of source code must retain the above copyright
|
||||
//! notice, this list of conditions and the following disclaimer.
|
||||
//! * 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.
|
||||
//! * Neither the name of the <ORGANIZATION> nor the names of its
|
||||
//! contributors may be used to endorse or promote products derived
|
||||
//! from this software without specific prior written permission.
|
||||
//!
|
||||
//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 _DHCP_H_
|
||||
#define _DHCP_H_
|
||||
|
||||
/*
|
||||
* @brief
|
||||
* @details If you want to display debug & processing message, Define _DHCP_DEBUG_
|
||||
* @note If defined, it depends on <stdio.h>
|
||||
*/
|
||||
|
||||
//#define _DHCP_DEBUG_
|
||||
|
||||
/* Retry to processing DHCP */
|
||||
#define MAX_DHCP_RETRY 2 ///< Maximum retry count
|
||||
#define DHCP_WAIT_TIME 3 ///< Wait Time 3s (was 10s)
|
||||
|
||||
/* UDP port numbers for DHCP */
|
||||
#define DHCP_SERVER_PORT 67 ///< DHCP server port number
|
||||
#define DHCP_CLIENT_PORT 68 ///< DHCP client port number
|
||||
|
||||
#define MAGIC_COOKIE 0x63825363 ///< Any number. You can be modified it any number
|
||||
|
||||
#define DCHP_HOST_NAME "WIZnet\0"
|
||||
|
||||
/*
|
||||
* @brief return value of @ref DHCP_run()
|
||||
*/
|
||||
enum
|
||||
{
|
||||
DHCP_FAILED = 0, ///< Processing Fail
|
||||
DHCP_RUNNING, ///< Processing DHCP protocol
|
||||
DHCP_IP_ASSIGN, ///< First Occupy IP from DHPC server (if cbfunc == null, act as default default_ip_assign)
|
||||
DHCP_IP_CHANGED, ///< Change IP address by new IP address from DHCP (if cbfunc == null, act as default default_ip_update)
|
||||
DHCP_IP_LEASED, ///< Stand by
|
||||
DHCP_STOPPED ///< Stop processing DHCP protocol
|
||||
};
|
||||
|
||||
#define DHCP_INIT_BUFFER_TYPE uint32_t
|
||||
#define DHCP_INIT_BUFFER_SIZE (137)
|
||||
/*
|
||||
* @brief DHCP client initialization (outside of the main loop)
|
||||
* @param s - socket number
|
||||
* @param buf - buffer for processing DHCP message
|
||||
*/
|
||||
void DHCP_init(uint8_t s, DHCP_INIT_BUFFER_TYPE* buf);
|
||||
|
||||
/*
|
||||
* @brief DHCP 1s Tick Timer handler
|
||||
* @note SHOULD BE register to your system 1s Tick timer handler
|
||||
*/
|
||||
void DHCP_time_handler(void);
|
||||
|
||||
/*
|
||||
* @brief Register call back function
|
||||
* @param ip_assign - callback func when IP is assigned from DHCP server first
|
||||
* @param ip_update - callback func when IP is changed
|
||||
* @prarm ip_conflict - callback func when the assigned IP is conflict with others.
|
||||
*/
|
||||
void reg_dhcp_cbfunc(void(*ip_assign)(void), void(*ip_update)(void), void(*ip_conflict)(void));
|
||||
|
||||
/*
|
||||
* @brief DHCP client in the main loop
|
||||
* @return The value is as the follow \n
|
||||
* @ref DHCP_FAILED \n
|
||||
* @ref DHCP_RUNNING \n
|
||||
* @ref DHCP_IP_ASSIGN \n
|
||||
* @ref DHCP_IP_CHANGED \n
|
||||
* @ref DHCP_IP_LEASED \n
|
||||
* @ref DHCP_STOPPED \n
|
||||
*
|
||||
* @note This function is always called by you main task.
|
||||
*/
|
||||
uint8_t DHCP_run(void);
|
||||
|
||||
/*
|
||||
* @brief Stop DHCP processing
|
||||
* @note If you want to restart. call DHCP_init() and DHCP_run()
|
||||
*/
|
||||
void DHCP_stop(void);
|
||||
|
||||
/* Get Network information assigned from DHCP server */
|
||||
/*
|
||||
* @brief Get IP address
|
||||
* @param ip - IP address to be returned
|
||||
*/
|
||||
void getIPfromDHCP(uint8_t* ip);
|
||||
/*
|
||||
* @brief Get Gateway address
|
||||
* @param ip - Gateway address to be returned
|
||||
*/
|
||||
void getGWfromDHCP(uint8_t* ip);
|
||||
/*
|
||||
* @brief Get Subnet mask value
|
||||
* @param ip - Subnet mask to be returned
|
||||
*/
|
||||
void getSNfromDHCP(uint8_t* ip);
|
||||
/*
|
||||
* @brief Get DNS address
|
||||
* @param ip - DNS address to be returned
|
||||
*/
|
||||
void getDNSfromDHCP(uint8_t* ip);
|
||||
|
||||
/*
|
||||
* @brief Get the leased time by DHCP sever
|
||||
* @return unit 1s
|
||||
*/
|
||||
uint32_t getDHCPLeasetime(void);
|
||||
|
||||
#endif /* _DHCP_H_ */
|
572
drivers/wiznet5k/internet/dns/dns.c
Normal file
572
drivers/wiznet5k/internet/dns/dns.c
Normal file
@ -0,0 +1,572 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \file dns.c
|
||||
//! \brief DNS APIs Implement file.
|
||||
//! \details Send DNS query & Receive DNS reponse. \n
|
||||
//! It depends on stdlib.h & string.h in ansi-c library
|
||||
//! \version 1.1.0
|
||||
//! \date 2013/11/18
|
||||
//! \par Revision history
|
||||
//! <2013/10/21> 1st Release
|
||||
//! <2013/12/20> V1.1.0
|
||||
//! 1. Remove secondary DNS server in DNS_run
|
||||
//! If 1st DNS_run failed, call DNS_run with 2nd DNS again
|
||||
//! 2. DNS_timerHandler -> DNS_time_handler
|
||||
//! 3. Remove the unused define
|
||||
//! 4. Integrated dns.h dns.c & dns_parse.h dns_parse.c into dns.h & dns.c
|
||||
//! <2013/12/20> V1.1.0
|
||||
//! <2018/10/04> Modified HAL_GetTick for use with CircuitPython by Nick Moore
|
||||
//!
|
||||
//! \author Eric Jung & MidnightCow
|
||||
//! \copyright
|
||||
//!
|
||||
//! Copyright (c) 2013, WIZnet Co., LTD.
|
||||
//! All rights reserved.
|
||||
//!
|
||||
//! Redistribution and use in source and binary forms, with or without
|
||||
//! modification, are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * Redistributions of source code must retain the above copyright
|
||||
//! notice, this list of conditions and the following disclaimer.
|
||||
//! * 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.
|
||||
//! * Neither the name of the <ORGANIZATION> nor the names of its
|
||||
//! contributors may be used to endorse or promote products derived
|
||||
//! from this software without specific prior written permission.
|
||||
//!
|
||||
//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "tick.h"
|
||||
|
||||
//#include "Ethernet/socket.h"
|
||||
//#include "Internet/DNS/dns.h"
|
||||
#include "../../ethernet/socket.h"
|
||||
#include "dns.h"
|
||||
|
||||
#ifdef _DNS_DEBUG_
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#define INITRTT 2000L /* Initial smoothed response time */
|
||||
#define MAXCNAME (MAX_DOMAIN_NAME + (MAX_DOMAIN_NAME>>1)) /* Maximum amount of cname recursion */
|
||||
|
||||
#define TYPE_A 1 /* Host address */
|
||||
#define TYPE_NS 2 /* Name server */
|
||||
#define TYPE_MD 3 /* Mail destination (obsolete) */
|
||||
#define TYPE_MF 4 /* Mail forwarder (obsolete) */
|
||||
#define TYPE_CNAME 5 /* Canonical name */
|
||||
#define TYPE_SOA 6 /* Start of Authority */
|
||||
#define TYPE_MB 7 /* Mailbox name (experimental) */
|
||||
#define TYPE_MG 8 /* Mail group member (experimental) */
|
||||
#define TYPE_MR 9 /* Mail rename name (experimental) */
|
||||
#define TYPE_NULL 10 /* Null (experimental) */
|
||||
#define TYPE_WKS 11 /* Well-known sockets */
|
||||
#define TYPE_PTR 12 /* Pointer record */
|
||||
#define TYPE_HINFO 13 /* Host information */
|
||||
#define TYPE_MINFO 14 /* Mailbox information (experimental)*/
|
||||
#define TYPE_MX 15 /* Mail exchanger */
|
||||
#define TYPE_TXT 16 /* Text strings */
|
||||
#define TYPE_ANY 255 /* Matches any type */
|
||||
|
||||
#define CLASS_IN 1 /* The ARPA Internet */
|
||||
|
||||
/* Round trip timing parameters */
|
||||
#define AGAIN 8 /* Average RTT gain = 1/8 */
|
||||
#define LAGAIN 3 /* Log2(AGAIN) */
|
||||
#define DGAIN 4 /* Mean deviation gain = 1/4 */
|
||||
#define LDGAIN 2 /* log2(DGAIN) */
|
||||
|
||||
/* Header for all domain messages */
|
||||
struct dhdr
|
||||
{
|
||||
uint16_t id; /* Identification */
|
||||
uint8_t qr; /* Query/Response */
|
||||
#define QUERY 0
|
||||
#define RESPONSE 1
|
||||
uint8_t opcode;
|
||||
#define IQUERY 1
|
||||
uint8_t aa; /* Authoratative answer */
|
||||
uint8_t tc; /* Truncation */
|
||||
uint8_t rd; /* Recursion desired */
|
||||
uint8_t ra; /* Recursion available */
|
||||
uint8_t rcode; /* Response code */
|
||||
#define NO_ERROR 0
|
||||
#define FORMAT_ERROR 1
|
||||
#define SERVER_FAIL 2
|
||||
#define NAME_ERROR 3
|
||||
#define NOT_IMPL 4
|
||||
#define REFUSED 5
|
||||
uint16_t qdcount; /* Question count */
|
||||
uint16_t ancount; /* Answer count */
|
||||
uint16_t nscount; /* Authority (name server) count */
|
||||
uint16_t arcount; /* Additional record count */
|
||||
};
|
||||
|
||||
|
||||
uint8_t* pDNSMSG; // DNS message buffer
|
||||
uint8_t DNS_SOCKET; // SOCKET number for DNS
|
||||
uint16_t DNS_MSGID; // DNS message ID
|
||||
|
||||
|
||||
uint32_t HAL_GetTick(void) {
|
||||
return ticks_ms;
|
||||
}
|
||||
|
||||
uint32_t hal_sys_tick;
|
||||
|
||||
/* converts uint16_t from network buffer to a host byte order integer. */
|
||||
uint16_t get16(uint8_t * s)
|
||||
{
|
||||
uint16_t i;
|
||||
i = *s++ << 8;
|
||||
i = i + *s;
|
||||
return i;
|
||||
}
|
||||
|
||||
/* copies uint16_t to the network buffer with network byte order. */
|
||||
uint8_t * put16(uint8_t * s, uint16_t i)
|
||||
{
|
||||
*s++ = i >> 8;
|
||||
*s++ = i;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CONVERT A DOMAIN NAME TO THE HUMAN-READABLE FORM
|
||||
*
|
||||
* Description : This function converts a compressed domain name to the human-readable form
|
||||
* Arguments : msg - is a pointer to the reply message
|
||||
* compressed - is a pointer to the domain name in reply message.
|
||||
* buf - is a pointer to the buffer for the human-readable form name.
|
||||
* len - is the MAX. size of buffer.
|
||||
* Returns : the length of compressed message
|
||||
*/
|
||||
int parse_name(uint8_t * msg, uint8_t * compressed, char * buf, int16_t len)
|
||||
{
|
||||
uint16_t slen; /* Length of current segment */
|
||||
uint8_t * cp;
|
||||
int clen = 0; /* Total length of compressed name */
|
||||
int indirect = 0; /* Set if indirection encountered */
|
||||
int nseg = 0; /* Total number of segments in name */
|
||||
|
||||
cp = compressed;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
slen = *cp++; /* Length of this segment */
|
||||
|
||||
if (!indirect) clen++;
|
||||
|
||||
if ((slen & 0xc0) == 0xc0)
|
||||
{
|
||||
if (!indirect)
|
||||
clen++;
|
||||
indirect = 1;
|
||||
/* Follow indirection */
|
||||
cp = &msg[((slen & 0x3f)<<8) + *cp];
|
||||
slen = *cp++;
|
||||
}
|
||||
|
||||
if (slen == 0) /* zero length == all done */
|
||||
break;
|
||||
|
||||
len -= slen + 1;
|
||||
|
||||
if (len < 0) return -1;
|
||||
|
||||
if (!indirect) clen += slen;
|
||||
|
||||
while (slen-- != 0) *buf++ = (char)*cp++;
|
||||
*buf++ = '.';
|
||||
nseg++;
|
||||
}
|
||||
|
||||
if (nseg == 0)
|
||||
{
|
||||
/* Root name; represent as single dot */
|
||||
*buf++ = '.';
|
||||
len--;
|
||||
}
|
||||
|
||||
*buf++ = '\0';
|
||||
len--;
|
||||
|
||||
return clen; /* Length of compressed message */
|
||||
}
|
||||
|
||||
/*
|
||||
* PARSE QUESTION SECTION
|
||||
*
|
||||
* Description : This function parses the question record of the reply message.
|
||||
* Arguments : msg - is a pointer to the reply message
|
||||
* cp - is a pointer to the question record.
|
||||
* Returns : a pointer the to next record.
|
||||
*/
|
||||
uint8_t * dns_question(uint8_t * msg, uint8_t * cp)
|
||||
{
|
||||
int len;
|
||||
char name[MAXCNAME];
|
||||
|
||||
len = parse_name(msg, cp, name, MAXCNAME);
|
||||
|
||||
|
||||
if (len == -1) return 0;
|
||||
|
||||
cp += len;
|
||||
cp += 2; /* type */
|
||||
cp += 2; /* class */
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* PARSE ANSER SECTION
|
||||
*
|
||||
* Description : This function parses the answer record of the reply message.
|
||||
* Arguments : msg - is a pointer to the reply message
|
||||
* cp - is a pointer to the answer record.
|
||||
* Returns : a pointer the to next record.
|
||||
*/
|
||||
uint8_t * dns_answer(uint8_t * msg, uint8_t * cp, uint8_t * ip_from_dns)
|
||||
{
|
||||
int len, type;
|
||||
char name[MAXCNAME];
|
||||
|
||||
len = parse_name(msg, cp, name, MAXCNAME);
|
||||
|
||||
if (len == -1) return 0;
|
||||
|
||||
cp += len;
|
||||
type = get16(cp);
|
||||
cp += 2; /* type */
|
||||
cp += 2; /* class */
|
||||
cp += 4; /* ttl */
|
||||
cp += 2; /* len */
|
||||
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case TYPE_A:
|
||||
/* Just read the address directly into the structure */
|
||||
ip_from_dns[0] = *cp++;
|
||||
ip_from_dns[1] = *cp++;
|
||||
ip_from_dns[2] = *cp++;
|
||||
ip_from_dns[3] = *cp++;
|
||||
break;
|
||||
case TYPE_CNAME:
|
||||
case TYPE_MB:
|
||||
case TYPE_MG:
|
||||
case TYPE_MR:
|
||||
case TYPE_NS:
|
||||
case TYPE_PTR:
|
||||
/* These types all consist of a single domain name */
|
||||
/* convert it to ASCII format */
|
||||
len = parse_name(msg, cp, name, MAXCNAME);
|
||||
if (len == -1) return 0;
|
||||
|
||||
cp += len;
|
||||
break;
|
||||
case TYPE_HINFO:
|
||||
len = *cp++;
|
||||
cp += len;
|
||||
|
||||
len = *cp++;
|
||||
cp += len;
|
||||
break;
|
||||
case TYPE_MX:
|
||||
cp += 2;
|
||||
/* Get domain name of exchanger */
|
||||
len = parse_name(msg, cp, name, MAXCNAME);
|
||||
if (len == -1) return 0;
|
||||
|
||||
cp += len;
|
||||
break;
|
||||
case TYPE_SOA:
|
||||
/* Get domain name of name server */
|
||||
len = parse_name(msg, cp, name, MAXCNAME);
|
||||
if (len == -1) return 0;
|
||||
|
||||
cp += len;
|
||||
|
||||
/* Get domain name of responsible person */
|
||||
len = parse_name(msg, cp, name, MAXCNAME);
|
||||
if (len == -1) return 0;
|
||||
|
||||
cp += len;
|
||||
|
||||
cp += 4;
|
||||
cp += 4;
|
||||
cp += 4;
|
||||
cp += 4;
|
||||
cp += 4;
|
||||
break;
|
||||
case TYPE_TXT:
|
||||
/* Just stash */
|
||||
break;
|
||||
default:
|
||||
/* Ignore */
|
||||
break;
|
||||
}
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
/*
|
||||
* PARSE THE DNS REPLY
|
||||
*
|
||||
* Description : This function parses the reply message from DNS server.
|
||||
* Arguments : dhdr - is a pointer to the header for DNS message
|
||||
* buf - is a pointer to the reply message.
|
||||
* len - is the size of reply message.
|
||||
* Returns : -1 - Domain name length is too big
|
||||
* 0 - Fail (Timeout or parse error)
|
||||
* 1 - Success,
|
||||
*/
|
||||
int8_t parseDNSMSG(struct dhdr * pdhdr, uint8_t * pbuf, uint8_t * ip_from_dns)
|
||||
{
|
||||
uint16_t tmp;
|
||||
uint16_t i;
|
||||
uint8_t * msg;
|
||||
uint8_t * cp;
|
||||
|
||||
msg = pbuf;
|
||||
memset(pdhdr, 0, sizeof(*pdhdr));
|
||||
|
||||
pdhdr->id = get16(&msg[0]);
|
||||
tmp = get16(&msg[2]);
|
||||
if (tmp & 0x8000) pdhdr->qr = 1;
|
||||
|
||||
pdhdr->opcode = (tmp >> 11) & 0xf;
|
||||
|
||||
if (tmp & 0x0400) pdhdr->aa = 1;
|
||||
if (tmp & 0x0200) pdhdr->tc = 1;
|
||||
if (tmp & 0x0100) pdhdr->rd = 1;
|
||||
if (tmp & 0x0080) pdhdr->ra = 1;
|
||||
|
||||
pdhdr->rcode = tmp & 0xf;
|
||||
pdhdr->qdcount = get16(&msg[4]);
|
||||
pdhdr->ancount = get16(&msg[6]);
|
||||
pdhdr->nscount = get16(&msg[8]);
|
||||
pdhdr->arcount = get16(&msg[10]);
|
||||
|
||||
|
||||
/* Now parse the variable length sections */
|
||||
cp = &msg[12];
|
||||
|
||||
/* Question section */
|
||||
for (i = 0; i < pdhdr->qdcount; i++)
|
||||
{
|
||||
cp = dns_question(msg, cp);
|
||||
if(!cp)
|
||||
{
|
||||
#ifdef _DNS_DEBUG_
|
||||
printf("MAX_DOMAIN_NAME is too small, it should be redefined in dns.h\r\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Answer section */
|
||||
for (i = 0; i < pdhdr->ancount; i++)
|
||||
{
|
||||
cp = dns_answer(msg, cp, ip_from_dns);
|
||||
if(!cp)
|
||||
{
|
||||
#ifdef _DNS_DEBUG_
|
||||
printf("MAX_DOMAIN_NAME is too small, it should be redefined in dns.h\r\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Name server (authority) section */
|
||||
for (i = 0; i < pdhdr->nscount; i++)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
/* Additional section */
|
||||
for (i = 0; i < pdhdr->arcount; i++)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
if(pdhdr->rcode == 0) return 1; // No error
|
||||
else return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MAKE DNS QUERY MESSAGE
|
||||
*
|
||||
* Description : This function makes DNS query message.
|
||||
* Arguments : op - Recursion desired
|
||||
* name - is a pointer to the domain name.
|
||||
* buf - is a pointer to the buffer for DNS message.
|
||||
* len - is the MAX. size of buffer.
|
||||
* Returns : the pointer to the DNS message.
|
||||
*/
|
||||
int16_t dns_makequery(uint16_t op, char * name, uint8_t * buf, uint16_t len)
|
||||
{
|
||||
uint8_t *cp;
|
||||
char *cp1;
|
||||
char sname[MAXCNAME];
|
||||
char *dname;
|
||||
uint16_t p;
|
||||
uint16_t dlen;
|
||||
|
||||
cp = buf;
|
||||
|
||||
DNS_MSGID++;
|
||||
cp = put16(cp, DNS_MSGID);
|
||||
p = (op << 11) | 0x0100; /* Recursion desired */
|
||||
cp = put16(cp, p);
|
||||
cp = put16(cp, 1);
|
||||
cp = put16(cp, 0);
|
||||
cp = put16(cp, 0);
|
||||
cp = put16(cp, 0);
|
||||
|
||||
strcpy(sname, name);
|
||||
dname = sname;
|
||||
dlen = strlen(dname);
|
||||
for (;;)
|
||||
{
|
||||
/* Look for next dot */
|
||||
cp1 = strchr(dname, '.');
|
||||
|
||||
if (cp1 != NULL) len = cp1 - dname; /* More to come */
|
||||
else len = dlen; /* Last component */
|
||||
|
||||
*cp++ = len; /* Write length of component */
|
||||
if (len == 0) break;
|
||||
|
||||
/* Copy component up to (but not including) dot */
|
||||
memcpy(cp, dname, len);
|
||||
cp += len;
|
||||
if (cp1 == NULL)
|
||||
{
|
||||
*cp++ = 0; /* Last one; write null and finish */
|
||||
break;
|
||||
}
|
||||
dname += len+1;
|
||||
dlen -= len+1;
|
||||
}
|
||||
|
||||
cp = put16(cp, 0x0001); /* type */
|
||||
cp = put16(cp, 0x0001); /* class */
|
||||
|
||||
return ((int16_t)((uint32_t)(cp) - (uint32_t)(buf)));
|
||||
}
|
||||
|
||||
/*
|
||||
* CHECK DNS TIMEOUT
|
||||
*
|
||||
* Description : This function check the DNS timeout
|
||||
* Arguments : None.
|
||||
* Returns : -1 - timeout occurred, 0 - timer over, but no timeout, 1 - no timer over, no timeout occur
|
||||
* Note : timeout : retry count and timer both over.
|
||||
*/
|
||||
|
||||
int8_t check_DNS_timeout(void)
|
||||
{
|
||||
static uint8_t retry_count;
|
||||
|
||||
uint32_t tick = HAL_GetTick();
|
||||
if(tick - hal_sys_tick >= DNS_WAIT_TIME * 1000)
|
||||
{
|
||||
hal_sys_tick = tick;
|
||||
if(retry_count >= MAX_DNS_RETRY) {
|
||||
retry_count = 0;
|
||||
return -1; // timeout occurred
|
||||
}
|
||||
retry_count++;
|
||||
return 0; // timer over, but no timeout
|
||||
}
|
||||
|
||||
return 1; // no timer over, no timeout occur
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* DNS CLIENT INIT */
|
||||
void DNS_init(uint8_t s, uint8_t * buf)
|
||||
{
|
||||
DNS_SOCKET = s; // SOCK_DNS
|
||||
pDNSMSG = buf; // User's shared buffer
|
||||
DNS_MSGID = DNS_MSG_ID;
|
||||
}
|
||||
|
||||
/* DNS CLIENT RUN */
|
||||
int8_t DNS_run(uint8_t * dns_ip, uint8_t * name, uint8_t * ip_from_dns)
|
||||
{
|
||||
int8_t ret;
|
||||
struct dhdr dhp;
|
||||
uint8_t ip[4];
|
||||
uint16_t len, port;
|
||||
int8_t ret_check_timeout;
|
||||
|
||||
hal_sys_tick = HAL_GetTick();
|
||||
|
||||
// Socket open
|
||||
WIZCHIP_EXPORT(socket)(DNS_SOCKET, Sn_MR_UDP, 0, 0);
|
||||
|
||||
#ifdef _DNS_DEBUG_
|
||||
printf("> DNS Query to DNS Server : %d.%d.%d.%d\r\n", dns_ip[0], dns_ip[1], dns_ip[2], dns_ip[3]);
|
||||
#endif
|
||||
|
||||
len = dns_makequery(0, (char *)name, pDNSMSG, MAX_DNS_BUF_SIZE);
|
||||
WIZCHIP_EXPORT(sendto)(DNS_SOCKET, pDNSMSG, len, dns_ip, IPPORT_DOMAIN);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if ((len = getSn_RX_RSR(DNS_SOCKET)) > 0)
|
||||
{
|
||||
if (len > MAX_DNS_BUF_SIZE) len = MAX_DNS_BUF_SIZE;
|
||||
len = WIZCHIP_EXPORT(recvfrom)(DNS_SOCKET, pDNSMSG, len, ip, &port);
|
||||
#ifdef _DNS_DEBUG_
|
||||
printf("> Receive DNS message from %d.%d.%d.%d(%d). len = %d\r\n", ip[0], ip[1], ip[2], ip[3],port,len);
|
||||
#endif
|
||||
ret = parseDNSMSG(&dhp, pDNSMSG, ip_from_dns);
|
||||
break;
|
||||
}
|
||||
// Check Timeout
|
||||
ret_check_timeout = check_DNS_timeout();
|
||||
if (ret_check_timeout < 0) {
|
||||
|
||||
#ifdef _DNS_DEBUG_
|
||||
printf("> DNS Server is not responding : %d.%d.%d.%d\r\n", dns_ip[0], dns_ip[1], dns_ip[2], dns_ip[3]);
|
||||
#endif
|
||||
return 0; // timeout occurred
|
||||
}
|
||||
else if (ret_check_timeout == 0) {
|
||||
|
||||
#ifdef _DNS_DEBUG_
|
||||
printf("> DNS Timeout\r\n");
|
||||
#endif
|
||||
WIZCHIP_EXPORT(sendto)(DNS_SOCKET, pDNSMSG, len, dns_ip, IPPORT_DOMAIN);
|
||||
}
|
||||
}
|
||||
WIZCHIP_EXPORT(close)(DNS_SOCKET);
|
||||
// Return value
|
||||
// 0 > : failed / 1 - success
|
||||
return ret;
|
||||
}
|
96
drivers/wiznet5k/internet/dns/dns.h
Normal file
96
drivers/wiznet5k/internet/dns/dns.h
Normal file
@ -0,0 +1,96 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \file dns.h
|
||||
//! \brief DNS APIs Header file.
|
||||
//! \details Send DNS query & Receive DNS reponse.
|
||||
//! \version 1.1.0
|
||||
//! \date 2013/11/18
|
||||
//! \par Revision history
|
||||
//! <2013/10/21> 1st Release
|
||||
//! <2013/12/20> V1.1.0
|
||||
//! 1. Remove secondary DNS server in DNS_run
|
||||
//! If 1st DNS_run failed, call DNS_run with 2nd DNS again
|
||||
//! 2. DNS_timerHandler -> DNS_time_handler
|
||||
//! 3. Move the no reference define to dns.c
|
||||
//! 4. Integrated dns.h dns.c & dns_parse.h dns_parse.c into dns.h & dns.c
|
||||
//! <2013/12/20> V1.1.0
|
||||
//!
|
||||
//! \author Eric Jung & MidnightCow
|
||||
//! \copyright
|
||||
//!
|
||||
//! Copyright (c) 2013, WIZnet Co., LTD.
|
||||
//! All rights reserved.
|
||||
//!
|
||||
//! Redistribution and use in source and binary forms, with or without
|
||||
//! modification, are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * Redistributions of source code must retain the above copyright
|
||||
//! notice, this list of conditions and the following disclaimer.
|
||||
//! * 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.
|
||||
//! * Neither the name of the <ORGANIZATION> nor the names of its
|
||||
//! contributors may be used to endorse or promote products derived
|
||||
//! from this software without specific prior written permission.
|
||||
//!
|
||||
//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 _DNS_H_
|
||||
#define _DNS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
/*
|
||||
* @brief Define it for Debug & Monitor DNS processing.
|
||||
* @note If defined, it depends on <stdio.h>
|
||||
*/
|
||||
|
||||
//#define _DNS_DEBUG_
|
||||
|
||||
#define MAX_DNS_BUF_SIZE 256 ///< maximum size of DNS buffer. */
|
||||
/*
|
||||
* @brief Maximum length of your queried Domain name
|
||||
* @todo SHOULD BE defined it equal as or greater than your Domain name length + null character(1)
|
||||
* @note SHOULD BE careful to stack overflow because it is allocated 1.5 times as MAX_DOMAIN_NAME in stack.
|
||||
*/
|
||||
#define MAX_DOMAIN_NAME 32 // for example "www.google.com"
|
||||
|
||||
#define MAX_DNS_RETRY 2 ///< Requery Count
|
||||
#define DNS_WAIT_TIME 4 ///< Wait response time. unit 1s.
|
||||
|
||||
#define IPPORT_DOMAIN 53 ///< DNS server port number
|
||||
|
||||
#define DNS_MSG_ID 0x1122 ///< ID for DNS message. You can be modified it any number
|
||||
/*
|
||||
* @brief DNS process initialize
|
||||
* @param s : Socket number for DNS
|
||||
* @param buf : Buffer for DNS message
|
||||
*/
|
||||
void DNS_init(uint8_t s, uint8_t * buf);
|
||||
|
||||
/*
|
||||
* @brief DNS process
|
||||
* @details Send DNS query and receive DNS response
|
||||
* @param dns_ip : DNS server ip address
|
||||
* @param name : Domain name to be queried
|
||||
* @param ip_from_dns : IP address from DNS server
|
||||
* @return -1 : failed. @ref MAX_DOMIN_NAME is too small \n
|
||||
* 0 : failed (Timeout or Parse error)\n
|
||||
* 1 : success
|
||||
* @note This function blocks until success or fail. max time = @ref MAX_DNS_RETRY * @ref DNS_WAIT_TIME
|
||||
*/
|
||||
int8_t DNS_run(uint8_t * dns_ip, uint8_t * name, uint8_t * ip_from_dns);
|
||||
|
||||
#endif /* _DNS_H_ */
|
@ -1 +1 @@
|
||||
Subproject commit 07919641470edb602585c6a91f7b8eacf17e664b
|
||||
Subproject commit d86fc7e81d51465ca1eae6f8c1141f81f065f5aa
|
@ -1 +1 @@
|
||||
Subproject commit d0aa6dc56d66decfae92daced7384c1e3518a666
|
||||
Subproject commit f4ee725fb93fd1a31666d3f71d10c94eb96df7c8
|
@ -1 +1 @@
|
||||
Subproject commit 44f52c5dacd9fc605565e5794e95c9a785aaf693
|
||||
Subproject commit 412392c8bdb6b4378e007eb7974c76b92fa9ff1d
|
@ -1 +1 @@
|
||||
Subproject commit af25424ee7dbebea3e5d77390c017018ffa52d36
|
||||
Subproject commit 03c24157d46672c723021686f7a838cfeb2db2ba
|
@ -1 +1 @@
|
||||
Subproject commit 5c2f6ef1ed80f24b6a3878067d40350d3725e198
|
||||
Subproject commit f5e70e09250f2a25ebb6487a30a763041644c5d3
|
@ -1 +1 @@
|
||||
Subproject commit c29e10b590efbdf06163897b49cd0c2bea82ad6e
|
||||
Subproject commit ec11164ec6682094a48d0f9848d2c4c89c08f3bc
|
@ -1 +1 @@
|
||||
Subproject commit c4152a0d87a04903ae0e612eb381af440c9e28b3
|
||||
Subproject commit 6298cd363811ad6ac10d4325c898be87a70d7bb2
|
@ -1 +1 @@
|
||||
Subproject commit e0b709f1710555da67705360870ba0d14ced7e06
|
||||
Subproject commit 4421e79661002ff8da6c0c4f22940ec843ee300b
|
@ -1 +1 @@
|
||||
Subproject commit e9f50cb6678a1684591ee021b95a3c4b51786fee
|
||||
Subproject commit 72e8f3855ecd136641d536a49311c38ee4f76f33
|
@ -1 +1 @@
|
||||
Subproject commit 00f4ebca6c740b76c1c464f83d514ac20b0600e1
|
||||
Subproject commit eae584918e72ff5fa323825470f276b31829ef9f
|
@ -1 +1 @@
|
||||
Subproject commit 340cd17fad0c29d3a70d6e298a30ecc753df054e
|
||||
Subproject commit c92c22ff029ee05bd392299cf25887e9af48903a
|
@ -2579,8 +2579,8 @@ FRESULT create_name ( /* FR_OK: successful, FR_INVALID_NAME: could not create
|
||||
if (w < 0x80 && chk_chr("\"*:<>\?|\x7F", w)) return FR_INVALID_NAME; /* Reject illegal characters for LFN */
|
||||
lfn[di++] = w; /* Store the Unicode character */
|
||||
}
|
||||
cf = ((w < ' ') || ((w == '/' || w == '\\') && p[si+1] < ' ')) ? NS_LAST : 0; /* Set last segment flag if end of the path */
|
||||
*path = &p[si]; /* Return pointer to the next segment */
|
||||
cf = (w < ' ') ? NS_LAST : 0; /* Set last segment flag if end of the path */
|
||||
#if _FS_RPATH != 0
|
||||
if ((di == 1 && lfn[di - 1] == '.') ||
|
||||
(di == 2 && lfn[di - 1] == '.' && lfn[di - 2] == '.')) { /* Is this segment a dot name? */
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 583326e535454f16b06ebdb9cc06869602a5564c
|
||||
Subproject commit 47fabe42edaae4a5da6aa0d48c664a9184578753
|
@ -12,11 +12,21 @@
|
||||
// Send "cooked" string of given length, where every occurrence of
|
||||
// LF character is replaced with CR LF.
|
||||
void mp_hal_stdout_tx_strn_cooked(const char *str, size_t len) {
|
||||
while (len--) {
|
||||
if (*str == '\n') {
|
||||
bool last_cr = false;
|
||||
while (len > 0) {
|
||||
size_t i = 0;
|
||||
if (str[0] == '\n' && !last_cr) {
|
||||
mp_hal_stdout_tx_strn("\r", 1);
|
||||
i = 1;
|
||||
}
|
||||
mp_hal_stdout_tx_strn(str++, 1);
|
||||
// Lump all characters on the next line together.
|
||||
while((last_cr || str[i] != '\n') && i < len) {
|
||||
last_cr = str[i] == '\r';
|
||||
i++;
|
||||
}
|
||||
mp_hal_stdout_tx_strn(str, i);
|
||||
str = &str[i];
|
||||
len -= i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
|
||||
"POT-Creation-Date: 2018-11-09 16:20-0800\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -147,78 +147,78 @@ msgstr ""
|
||||
msgid "invalid arguments"
|
||||
msgstr ""
|
||||
|
||||
#: lib/utils/pyexec.c:97 py/builtinimport.c:253
|
||||
#: lib/utils/pyexec.c:97 py/builtinimport.c:251
|
||||
msgid "script compilation not supported"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:143
|
||||
#: main.c:154
|
||||
msgid " output:\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:157 main.c:230
|
||||
#: main.c:168 main.c:241
|
||||
msgid ""
|
||||
"Auto-reload is on. Simply save files over USB to run them or enter REPL to "
|
||||
"disable.\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:159
|
||||
#: main.c:170
|
||||
msgid "Running in safe mode! Auto-reload is off.\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:161 main.c:232
|
||||
#: main.c:172 main.c:243
|
||||
msgid "Auto-reload is off.\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:175
|
||||
#: main.c:186
|
||||
msgid "Running in safe mode! Not running saved code.\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:191
|
||||
#: main.c:202
|
||||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:239
|
||||
#: main.c:250
|
||||
msgid "You requested starting safe mode by "
|
||||
msgstr ""
|
||||
|
||||
#: main.c:242
|
||||
#: main.c:253
|
||||
msgid "To exit, please reset the board without "
|
||||
msgstr ""
|
||||
|
||||
#: main.c:249
|
||||
#: main.c:260
|
||||
msgid ""
|
||||
"You are running in safe mode which means something really bad happened.\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:251
|
||||
#: main.c:262
|
||||
msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:252
|
||||
#: main.c:263
|
||||
msgid "Please file an issue here with the contents of your CIRCUITPY drive:\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:255
|
||||
#: main.c:266
|
||||
msgid ""
|
||||
"The microcontroller's power dipped. Please make sure your power supply "
|
||||
"provides\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:256
|
||||
#: main.c:267
|
||||
msgid ""
|
||||
"enough power for the whole circuit and press reset (after ejecting "
|
||||
"CIRCUITPY).\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:260
|
||||
#: main.c:271
|
||||
msgid "Press any key to enter the REPL. Use CTRL-D to reload."
|
||||
msgstr ""
|
||||
|
||||
#: main.c:416
|
||||
#: main.c:429
|
||||
msgid "soft reboot\n"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/audio_dma.c:285
|
||||
#: ports/atmel-samd/audio_dma.c:209
|
||||
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:361
|
||||
msgid "All sync event channels in use"
|
||||
msgstr ""
|
||||
@ -291,12 +291,12 @@ msgid "Too many channels in sample."
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:339
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:417
|
||||
msgid "No DMA channel found"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:341
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:419
|
||||
msgid "Unable to allocate buffers for signed conversion"
|
||||
msgstr ""
|
||||
|
||||
@ -312,43 +312,44 @@ msgstr ""
|
||||
msgid "sampling rate out of range"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:69
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:132
|
||||
msgid "DAC already in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:73
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:136
|
||||
msgid "Right channel unsupported"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:76
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:139
|
||||
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:116
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c:65
|
||||
msgid "Invalid pin"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:84
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:147
|
||||
msgid "Invalid pin for left channel"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:88
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:151
|
||||
msgid "Invalid pin for right channel"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:91
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:154
|
||||
msgid "Cannot output both channels on the same pin"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:176
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:243
|
||||
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189
|
||||
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
|
||||
#: ports/nrf/common-hal/pulseio/PulseOut.c:107
|
||||
msgid "All timers in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:218
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:285
|
||||
msgid "All event channels in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:297
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:375
|
||||
#, c-format
|
||||
msgid "Sample rate too high. It must be less than %d"
|
||||
msgstr ""
|
||||
@ -358,10 +359,10 @@ msgid "Not enough pins available"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/I2C.c:78
|
||||
#: ports/atmel-samd/common-hal/busio/SPI.c:132
|
||||
#: ports/atmel-samd/common-hal/busio/SPI.c:171
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c:119
|
||||
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
|
||||
#: ports/nrf/common-hal/busio/I2C.c:77
|
||||
#: ports/nrf/common-hal/busio/I2C.c:82
|
||||
msgid "Invalid pins"
|
||||
msgstr ""
|
||||
|
||||
@ -378,10 +379,12 @@ msgid "bytes > 8 bits not supported"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c:72
|
||||
#: ports/nrf/common-hal/busio/UART.c:82
|
||||
msgid "tx and rx cannot both be None"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c:145
|
||||
#: ports/nrf/common-hal/busio/UART.c:115
|
||||
msgid "Failed to allocate RX buffer"
|
||||
msgstr ""
|
||||
|
||||
@ -390,15 +393,17 @@ msgid "Could not initialize UART"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c:240
|
||||
#: ports/nrf/common-hal/busio/UART.c:149
|
||||
msgid "No RX pin"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c:294
|
||||
#: ports/nrf/common-hal/busio/UART.c:195
|
||||
msgid "No TX pin"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c:170
|
||||
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:142
|
||||
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:147
|
||||
msgid "Cannot get pull while in output mode"
|
||||
msgstr ""
|
||||
|
||||
@ -409,7 +414,8 @@ msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120
|
||||
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369
|
||||
#: ports/nrf/common-hal/pulseio/PWMOut.c:227
|
||||
#: ports/nrf/common-hal/pulseio/PWMOut.c:119
|
||||
#: ports/nrf/common-hal/pulseio/PWMOut.c:233
|
||||
msgid "Invalid PWM frequency"
|
||||
msgstr ""
|
||||
|
||||
@ -457,30 +463,10 @@ msgstr ""
|
||||
msgid "calibration value out of range +/-127"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/storage/__init__.c:48
|
||||
msgid "Cannot remount '/' when USB is active."
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c:75
|
||||
msgid "No free GCLKs"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/usb_hid/Device.c:78
|
||||
#: ports/nrf/common-hal/usb_hid/Device.c:45
|
||||
#, c-format
|
||||
msgid "Buffer incorrect size. Should be %d bytes."
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/usb_hid/Device.c:82
|
||||
#: ports/nrf/common-hal/usb_hid/Device.c:53
|
||||
msgid "USB Busy"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/usb_hid/Device.c:82
|
||||
#: ports/nrf/common-hal/usb_hid/Device.c:59
|
||||
msgid "USB Error"
|
||||
msgstr ""
|
||||
|
||||
#: ports/esp8266/common-hal/analogio/AnalogIn.c:43
|
||||
msgid "Pin %q does not have ADC capabilities"
|
||||
msgstr ""
|
||||
@ -690,24 +676,156 @@ msgstr ""
|
||||
msgid "AnalogOut functionality not supported"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c:91
|
||||
#: ports/nrf/common-hal/bleio/Adapter.c:41
|
||||
#, c-format
|
||||
msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Adapter.c:125
|
||||
#, c-format
|
||||
msgid "Failed to change softdevice state, error: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Adapter.c:135
|
||||
#, c-format
|
||||
msgid "Failed to get softdevice state, error: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Adapter.c:155
|
||||
#, c-format
|
||||
msgid "Failed to get local address, error: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:52
|
||||
#, c-format
|
||||
msgid "Failed to write gatts value, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:76
|
||||
#, c-format
|
||||
msgid "Failed to notify attribute value, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:91
|
||||
#, c-format
|
||||
msgid "Failed to read attribute value, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:119
|
||||
#: ports/nrf/common-hal/bleio/Device.c:272
|
||||
#: ports/nrf/common-hal/bleio/Device.c:307
|
||||
#, c-format
|
||||
msgid "Failed to acquire mutex, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:126
|
||||
#, c-format
|
||||
msgid "Failed to write attribute value, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:138
|
||||
#: ports/nrf/common-hal/bleio/Device.c:284
|
||||
#: ports/nrf/common-hal/bleio/Device.c:319
|
||||
#: ports/nrf/common-hal/bleio/Device.c:354
|
||||
#: ports/nrf/common-hal/bleio/Device.c:391
|
||||
#, c-format
|
||||
msgid "Failed to release mutex, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:81
|
||||
#: ports/nrf/common-hal/bleio/Device.c:114
|
||||
msgid "Can not fit data into the advertisment packet"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:266
|
||||
#, c-format
|
||||
msgid "Failed to discover serivices, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:403
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c:76
|
||||
#, c-format
|
||||
msgid "Failed to continue scanning, status: 0x%0xlX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:436
|
||||
#, c-format
|
||||
msgid "Failed to connect, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:513
|
||||
#, c-format
|
||||
msgid "Failed to add service, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:531
|
||||
#, c-format
|
||||
msgid "Failed to start advertisment, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:549
|
||||
#, c-format
|
||||
msgid "Failed to stop advertisment, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:575
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c:103
|
||||
#, c-format
|
||||
msgid "Failed to start scanning, status: 0x%0xlX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:592
|
||||
#, c-format
|
||||
msgid "Failed to create mutex, status: 0x%0xlX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Service.c:83
|
||||
#, c-format
|
||||
msgid "Failed to add characteristic, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/UUID.c:97
|
||||
#, c-format
|
||||
msgid "Failed to add Vendor Specific UUID, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/UUID.c:102
|
||||
msgid "Invalid UUID string length"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/UUID.c:109
|
||||
#: shared-bindings/bleio/Characteristic.c:125
|
||||
#: shared-bindings/bleio/Service.c:105
|
||||
msgid "Invalid UUID parameter"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c:96
|
||||
msgid "All I2C peripherals are in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/SPI.c:109
|
||||
#: ports/nrf/common-hal/busio/SPI.c:133
|
||||
msgid "All SPI peripherals are in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/SPI.c:170
|
||||
msgid "Baud rate too high for this SPI peripheral"
|
||||
#: ports/nrf/common-hal/busio/UART.c:48
|
||||
#, c-format
|
||||
msgid "error = 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/UART.c:43 ports/nrf/common-hal/busio/UART.c:47
|
||||
#: ports/nrf/common-hal/busio/UART.c:51 ports/nrf/common-hal/busio/UART.c:60
|
||||
#: ports/nrf/common-hal/busio/UART.c:66 ports/nrf/common-hal/busio/UART.c:71
|
||||
#: ports/nrf/common-hal/busio/UART.c:76 ports/nrf/common-hal/busio/UART.c:81
|
||||
#: ports/nrf/common-hal/busio/UART.c:86 ports/nrf/common-hal/busio/UART.c:90
|
||||
msgid "busio.UART not yet implemented"
|
||||
#: ports/nrf/common-hal/busio/UART.c:86
|
||||
msgid "Invalid buffer size"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/UART.c:90
|
||||
msgid "Odd parity is not supported"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/UART.c:322 ports/nrf/common-hal/busio/UART.c:326
|
||||
#: ports/nrf/common-hal/busio/UART.c:331 ports/nrf/common-hal/busio/UART.c:336
|
||||
#: ports/nrf/common-hal/busio/UART.c:342 ports/nrf/common-hal/busio/UART.c:347
|
||||
#: ports/nrf/common-hal/busio/UART.c:352 ports/nrf/common-hal/busio/UART.c:356
|
||||
#: ports/nrf/common-hal/busio/UART.c:364
|
||||
msgid "busio.UART not available"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/microcontroller/Processor.c:49
|
||||
@ -715,105 +833,8 @@ msgstr ""
|
||||
msgid "Can not get temperature. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:199
|
||||
msgid "Cannot apply GAP parameters."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:213
|
||||
msgid "Cannot set PPCP parameters."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:245
|
||||
msgid "Can not query for the device address."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:264
|
||||
msgid "Can not add Vendor Specific 128-bit UUID."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:284
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:298
|
||||
msgid "Can not add Service."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:373
|
||||
msgid "Can not add Characteristic."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:400
|
||||
msgid "Can not apply device name in the stack."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:464
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:514
|
||||
msgid "Can not encode UUID, to check length."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:470
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:520
|
||||
msgid "Can encode UUID into the advertisment packet."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:545
|
||||
msgid "Can not fit data into the advertisment packet."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:558
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:604
|
||||
#, c-format
|
||||
msgid "Can not apply advertisment data. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:614
|
||||
#, c-format
|
||||
msgid "Can not start advertisment. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:631
|
||||
#, c-format
|
||||
msgid "Can not stop advertisment. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:650
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:726
|
||||
#, c-format
|
||||
msgid "Can not read attribute value. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:667
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:756
|
||||
#, c-format
|
||||
msgid "Can not write attribute value. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:691
|
||||
#, c-format
|
||||
msgid "Can not notify attribute value. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:784
|
||||
#, c-format
|
||||
msgid "Can not start scanning. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:829
|
||||
#, c-format
|
||||
msgid "Can not connect. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_characteristic.c:68
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_service.c:80
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_service.c:132
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_uuid.c:137
|
||||
msgid "Invalid UUID parameter"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_service.c:73
|
||||
msgid "Invalid Service type"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_uuid.c:127
|
||||
msgid "Invalid UUID string length"
|
||||
#: ports/nrf/common-hal/pulseio/PWMOut.c:161
|
||||
msgid "All PWM peripherals are in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/unix/modffi.c:138
|
||||
@ -917,19 +938,33 @@ msgstr ""
|
||||
msgid "bad compile mode"
|
||||
msgstr ""
|
||||
|
||||
#: py/builtinimport.c:338
|
||||
#: py/builtinhelp.c:137
|
||||
msgid "Plus any modules on the filesystem\n"
|
||||
msgstr ""
|
||||
|
||||
#: py/builtinhelp.c:183
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Welcome to Adafruit CircuitPython %s!\n"
|
||||
"\n"
|
||||
"Please visit learn.adafruit.com/category/circuitpython for project guides.\n"
|
||||
"\n"
|
||||
"To list built-in modules please do `help(\"modules\")`.\n"
|
||||
msgstr ""
|
||||
|
||||
#: py/builtinimport.c:336
|
||||
msgid "cannot perform relative import"
|
||||
msgstr ""
|
||||
|
||||
#: py/builtinimport.c:422 py/builtinimport.c:534
|
||||
#: py/builtinimport.c:420 py/builtinimport.c:532
|
||||
msgid "module not found"
|
||||
msgstr ""
|
||||
|
||||
#: py/builtinimport.c:425 py/builtinimport.c:537
|
||||
#: py/builtinimport.c:423 py/builtinimport.c:535
|
||||
msgid "no module named '%q'"
|
||||
msgstr ""
|
||||
|
||||
#: py/builtinimport.c:512
|
||||
#: py/builtinimport.c:510
|
||||
msgid "relative import"
|
||||
msgstr ""
|
||||
|
||||
@ -1078,6 +1113,72 @@ msgstr ""
|
||||
msgid "'data' requires integer arguments"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:102
|
||||
msgid "can only have up to 4 parameters to Thumb assembly"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:107 py/emitinlinethumb.c:112
|
||||
msgid "parameters must be registers in sequence r0 to r3"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:188 py/emitinlinethumb.c:230
|
||||
#, c-format
|
||||
msgid "'%s' expects at most r%d"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:197 py/emitinlinextensa.c:162
|
||||
#, c-format
|
||||
msgid "'%s' expects a register"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:211
|
||||
#, c-format
|
||||
msgid "'%s' expects a special register"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:239
|
||||
#, c-format
|
||||
msgid "'%s' expects an FPU register"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:292
|
||||
#, c-format
|
||||
msgid "'%s' expects {r0, r1, ...}"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:299 py/emitinlinextensa.c:169
|
||||
#, c-format
|
||||
msgid "'%s' expects an integer"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:304
|
||||
#, c-format
|
||||
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:328
|
||||
#, c-format
|
||||
msgid "'%s' expects an address of the form [a, b]"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:334 py/emitinlinextensa.c:182
|
||||
#, c-format
|
||||
msgid "'%s' expects a label"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:345 py/emitinlinextensa.c:193
|
||||
msgid "label '%q' not defined"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:806
|
||||
#, c-format
|
||||
msgid "unsupported Thumb instruction '%s' with %d arguments"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:810
|
||||
msgid "branch not in range"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinextensa.c:86
|
||||
msgid "can only have up to 4 parameters to Xtensa assembly"
|
||||
msgstr ""
|
||||
@ -1086,30 +1187,11 @@ msgstr ""
|
||||
msgid "parameters must be registers in sequence a2 to a5"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinextensa.c:162
|
||||
#, c-format
|
||||
msgid "'%s' expects a register"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinextensa.c:169
|
||||
#, c-format
|
||||
msgid "'%s' expects an integer"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinextensa.c:174
|
||||
#, c-format
|
||||
msgid "'%s' integer %d is not within range %d..%d"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinextensa.c:182
|
||||
#, c-format
|
||||
msgid "'%s' expects a label"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinextensa.c:193
|
||||
msgid "label '%q' not defined"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinextensa.c:327
|
||||
#, c-format
|
||||
msgid "unsupported Xtensa instruction '%s' with %d arguments"
|
||||
@ -1929,7 +2011,7 @@ msgid "AnalogOut is only 16 bits. Value must be less than 65536."
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiobusio/I2SOut.c:225
|
||||
#: shared-bindings/audioio/AudioOut.c:223
|
||||
#: shared-bindings/audioio/AudioOut.c:226
|
||||
msgid "Not playing"
|
||||
msgstr ""
|
||||
|
||||
@ -1966,6 +2048,22 @@ msgid ""
|
||||
"destination buffer must be a bytearray or array of type 'B' for bit_depth = 8"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audioio/Mixer.c:94
|
||||
msgid "Invalid voice count"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audioio/Mixer.c:99
|
||||
msgid "Invalid channel count"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audioio/Mixer.c:103
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audioio/Mixer.c:107
|
||||
msgid "bits_per_sample must be 8 or 16"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audioio/RawSample.c:98
|
||||
msgid ""
|
||||
"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or "
|
||||
@ -1990,22 +2088,46 @@ msgstr ""
|
||||
msgid "Buffer must be at least length 1"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:168
|
||||
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:175
|
||||
msgid "Invalid polarity"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:172
|
||||
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:179
|
||||
msgid "Invalid phase"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:176
|
||||
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:183
|
||||
msgid "Invalid number of bits"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:341
|
||||
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:348
|
||||
msgid "buffer slices must be of equal length"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Address.c:101
|
||||
msgid "Wrong address length"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Address.c:107
|
||||
msgid "Wrong number of bytes provided"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c:210
|
||||
msgid "Can't add services in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c:226
|
||||
msgid "Can't connect in Peripheral mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c:256
|
||||
msgid "Can't change the name in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c:277 shared-bindings/bleio/Device.c:313
|
||||
msgid "Can't advertise in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/busio/I2C.c:120
|
||||
msgid "Function requires lock."
|
||||
msgstr ""
|
||||
@ -2120,7 +2242,7 @@ msgstr ""
|
||||
|
||||
#: shared-bindings/microcontroller/Pin.c:89
|
||||
#: shared-bindings/neopixel_write/__init__.c:67
|
||||
#: shared-bindings/pulseio/PulseOut.c:75
|
||||
#: shared-bindings/pulseio/PulseOut.c:76
|
||||
msgid "Expected a %q"
|
||||
msgstr ""
|
||||
|
||||
@ -2163,7 +2285,7 @@ msgstr ""
|
||||
|
||||
#: shared-bindings/pulseio/PWMOut.c:195
|
||||
msgid ""
|
||||
"PWM frequency not writeable when variable_frequency is False on construction."
|
||||
"PWM frequency not writable when variable_frequency is False on construction."
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/pulseio/PulseIn.c:275
|
||||
@ -2182,7 +2304,7 @@ msgstr ""
|
||||
msgid "Read-only"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/pulseio/PulseOut.c:134
|
||||
#: shared-bindings/pulseio/PulseOut.c:135
|
||||
msgid "Array must contain halfwords (type 'H')"
|
||||
msgstr ""
|
||||
|
||||
@ -2211,6 +2333,10 @@ msgstr ""
|
||||
msgid "RTC calibration is not supported on this board"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/socket/__init__.c:516 shared-module/network/__init__.c:81
|
||||
msgid "no available NIC"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/storage/__init__.c:77
|
||||
msgid "filesystem must provide mount method"
|
||||
msgstr ""
|
||||
@ -2235,15 +2361,15 @@ msgstr ""
|
||||
msgid "time.struct_time() takes a 9-sequence"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/time/__init__.c:169 shared-bindings/time/__init__.c:250
|
||||
#: shared-bindings/time/__init__.c:169 shared-bindings/time/__init__.c:264
|
||||
msgid "Tuple or struct_time argument required"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/time/__init__.c:174 shared-bindings/time/__init__.c:255
|
||||
#: shared-bindings/time/__init__.c:174 shared-bindings/time/__init__.c:269
|
||||
msgid "function takes exactly 9 arguments"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/time/__init__.c:226 shared-bindings/time/__init__.c:259
|
||||
#: shared-bindings/time/__init__.c:240 shared-bindings/time/__init__.c:273
|
||||
msgid "timestamp out of range for platform time_t"
|
||||
msgstr ""
|
||||
|
||||
@ -2256,6 +2382,34 @@ msgid ""
|
||||
"Object has been deinitialized and can no longer be used. Create a new object."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:47 shared-module/audioio/WaveFile.c:117
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:53 shared-module/audioio/WaveFile.c:123
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:82
|
||||
msgid "Voice index too high"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:85
|
||||
msgid "The sample's sample rate does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:88
|
||||
msgid "The sample's channel count does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:91
|
||||
msgid "The sample's bits_per_sample does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:100
|
||||
msgid "The sample's signedness does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/WaveFile.c:61
|
||||
msgid "Invalid wave file"
|
||||
msgstr ""
|
||||
@ -2276,39 +2430,31 @@ msgstr ""
|
||||
msgid "Invalid file"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/WaveFile.c:117
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/WaveFile.c:123
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/bitbangio/I2C.c:58
|
||||
msgid "Clock stretch too long"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:45
|
||||
#: shared-module/bitbangio/SPI.c:44
|
||||
msgid "Clock pin init failed."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:51
|
||||
#: shared-module/bitbangio/SPI.c:50
|
||||
msgid "MOSI pin init failed."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:62
|
||||
#: shared-module/bitbangio/SPI.c:61
|
||||
msgid "MISO pin init failed."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:122
|
||||
#: shared-module/bitbangio/SPI.c:121
|
||||
msgid "Cannot write without MOSI pin."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:177
|
||||
#: shared-module/bitbangio/SPI.c:176
|
||||
msgid "Cannot read without MISO pin."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:241
|
||||
#: shared-module/bitbangio/SPI.c:240
|
||||
msgid "Cannot transfer without MOSI and MISO pins."
|
||||
msgstr ""
|
||||
|
||||
@ -2342,6 +2488,10 @@ msgstr ""
|
||||
msgid "Only true color (24 bpp or higher) BMP supported %x"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/storage/__init__.c:155
|
||||
msgid "Cannot remount '/' when USB is active."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/struct/__init__.c:39
|
||||
msgid "'S' and 'O' are not supported format types"
|
||||
msgstr ""
|
||||
@ -2349,3 +2499,16 @@ msgstr ""
|
||||
#: shared-module/struct/__init__.c:83
|
||||
msgid "too many arguments provided with the given format"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/usb_hid/Device.c:45
|
||||
#, c-format
|
||||
msgid "Buffer incorrect size. Should be %d bytes."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/usb_hid/Device.c:53
|
||||
msgid "USB Busy"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/usb_hid/Device.c:59
|
||||
msgid "USB Error"
|
||||
msgstr ""
|
||||
|
703
locale/de_DE.po
703
locale/de_DE.po
File diff suppressed because it is too large
Load Diff
583
locale/en_US.po
583
locale/en_US.po
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
|
||||
"POT-Creation-Date: 2018-11-09 15:57-0800\n"
|
||||
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
@ -147,78 +147,78 @@ msgstr ""
|
||||
msgid "invalid arguments"
|
||||
msgstr ""
|
||||
|
||||
#: lib/utils/pyexec.c:97 py/builtinimport.c:253
|
||||
#: lib/utils/pyexec.c:97 py/builtinimport.c:251
|
||||
msgid "script compilation not supported"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:143
|
||||
#: main.c:154
|
||||
msgid " output:\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:157 main.c:230
|
||||
#: main.c:168 main.c:241
|
||||
msgid ""
|
||||
"Auto-reload is on. Simply save files over USB to run them or enter REPL to "
|
||||
"disable.\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:159
|
||||
#: main.c:170
|
||||
msgid "Running in safe mode! Auto-reload is off.\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:161 main.c:232
|
||||
#: main.c:172 main.c:243
|
||||
msgid "Auto-reload is off.\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:175
|
||||
#: main.c:186
|
||||
msgid "Running in safe mode! Not running saved code.\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:191
|
||||
#: main.c:202
|
||||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:239
|
||||
#: main.c:250
|
||||
msgid "You requested starting safe mode by "
|
||||
msgstr ""
|
||||
|
||||
#: main.c:242
|
||||
#: main.c:253
|
||||
msgid "To exit, please reset the board without "
|
||||
msgstr ""
|
||||
|
||||
#: main.c:249
|
||||
#: main.c:260
|
||||
msgid ""
|
||||
"You are running in safe mode which means something really bad happened.\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:251
|
||||
#: main.c:262
|
||||
msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:252
|
||||
#: main.c:263
|
||||
msgid "Please file an issue here with the contents of your CIRCUITPY drive:\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:255
|
||||
#: main.c:266
|
||||
msgid ""
|
||||
"The microcontroller's power dipped. Please make sure your power supply "
|
||||
"provides\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:256
|
||||
#: main.c:267
|
||||
msgid ""
|
||||
"enough power for the whole circuit and press reset (after ejecting "
|
||||
"CIRCUITPY).\n"
|
||||
msgstr ""
|
||||
|
||||
#: main.c:260
|
||||
#: main.c:271
|
||||
msgid "Press any key to enter the REPL. Use CTRL-D to reload."
|
||||
msgstr ""
|
||||
|
||||
#: main.c:416
|
||||
#: main.c:429
|
||||
msgid "soft reboot\n"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/audio_dma.c:285
|
||||
#: ports/atmel-samd/audio_dma.c:209
|
||||
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:361
|
||||
msgid "All sync event channels in use"
|
||||
msgstr ""
|
||||
@ -291,12 +291,12 @@ msgid "Too many channels in sample."
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:339
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:417
|
||||
msgid "No DMA channel found"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:341
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:419
|
||||
msgid "Unable to allocate buffers for signed conversion"
|
||||
msgstr ""
|
||||
|
||||
@ -312,43 +312,44 @@ msgstr ""
|
||||
msgid "sampling rate out of range"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:69
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:132
|
||||
msgid "DAC already in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:73
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:136
|
||||
msgid "Right channel unsupported"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:76
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:139
|
||||
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:116
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c:65
|
||||
msgid "Invalid pin"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:84
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:147
|
||||
msgid "Invalid pin for left channel"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:88
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:151
|
||||
msgid "Invalid pin for right channel"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:91
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:154
|
||||
msgid "Cannot output both channels on the same pin"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:176
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:243
|
||||
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189
|
||||
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
|
||||
#: ports/nrf/common-hal/pulseio/PulseOut.c:107
|
||||
msgid "All timers in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:218
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:285
|
||||
msgid "All event channels in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:297
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:375
|
||||
#, c-format
|
||||
msgid "Sample rate too high. It must be less than %d"
|
||||
msgstr ""
|
||||
@ -358,10 +359,10 @@ msgid "Not enough pins available"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/I2C.c:78
|
||||
#: ports/atmel-samd/common-hal/busio/SPI.c:132
|
||||
#: ports/atmel-samd/common-hal/busio/SPI.c:171
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c:119
|
||||
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
|
||||
#: ports/nrf/common-hal/busio/I2C.c:77
|
||||
#: ports/nrf/common-hal/busio/I2C.c:82
|
||||
msgid "Invalid pins"
|
||||
msgstr ""
|
||||
|
||||
@ -378,10 +379,12 @@ msgid "bytes > 8 bits not supported"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c:72
|
||||
#: ports/nrf/common-hal/busio/UART.c:82
|
||||
msgid "tx and rx cannot both be None"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c:145
|
||||
#: ports/nrf/common-hal/busio/UART.c:115
|
||||
msgid "Failed to allocate RX buffer"
|
||||
msgstr ""
|
||||
|
||||
@ -390,15 +393,17 @@ msgid "Could not initialize UART"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c:240
|
||||
#: ports/nrf/common-hal/busio/UART.c:149
|
||||
msgid "No RX pin"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c:294
|
||||
#: ports/nrf/common-hal/busio/UART.c:195
|
||||
msgid "No TX pin"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c:170
|
||||
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:142
|
||||
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:147
|
||||
msgid "Cannot get pull while in output mode"
|
||||
msgstr ""
|
||||
|
||||
@ -409,7 +414,8 @@ msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120
|
||||
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369
|
||||
#: ports/nrf/common-hal/pulseio/PWMOut.c:227
|
||||
#: ports/nrf/common-hal/pulseio/PWMOut.c:119
|
||||
#: ports/nrf/common-hal/pulseio/PWMOut.c:233
|
||||
msgid "Invalid PWM frequency"
|
||||
msgstr ""
|
||||
|
||||
@ -457,30 +463,10 @@ msgstr ""
|
||||
msgid "calibration value out of range +/-127"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/storage/__init__.c:48
|
||||
msgid "Cannot remount '/' when USB is active."
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c:75
|
||||
msgid "No free GCLKs"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/usb_hid/Device.c:78
|
||||
#: ports/nrf/common-hal/usb_hid/Device.c:45
|
||||
#, c-format
|
||||
msgid "Buffer incorrect size. Should be %d bytes."
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/usb_hid/Device.c:82
|
||||
#: ports/nrf/common-hal/usb_hid/Device.c:53
|
||||
msgid "USB Busy"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/usb_hid/Device.c:82
|
||||
#: ports/nrf/common-hal/usb_hid/Device.c:59
|
||||
msgid "USB Error"
|
||||
msgstr ""
|
||||
|
||||
#: ports/esp8266/common-hal/analogio/AnalogIn.c:43
|
||||
msgid "Pin %q does not have ADC capabilities"
|
||||
msgstr ""
|
||||
@ -690,24 +676,156 @@ msgstr ""
|
||||
msgid "AnalogOut functionality not supported"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c:91
|
||||
#: ports/nrf/common-hal/bleio/Adapter.c:41
|
||||
#, c-format
|
||||
msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Adapter.c:125
|
||||
#, c-format
|
||||
msgid "Failed to change softdevice state, error: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Adapter.c:135
|
||||
#, c-format
|
||||
msgid "Failed to get softdevice state, error: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Adapter.c:155
|
||||
#, c-format
|
||||
msgid "Failed to get local address, error: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:52
|
||||
#, c-format
|
||||
msgid "Failed to write gatts value, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:76
|
||||
#, c-format
|
||||
msgid "Failed to notify attribute value, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:91
|
||||
#, c-format
|
||||
msgid "Failed to read attribute value, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:119
|
||||
#: ports/nrf/common-hal/bleio/Device.c:272
|
||||
#: ports/nrf/common-hal/bleio/Device.c:307
|
||||
#, c-format
|
||||
msgid "Failed to acquire mutex, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:126
|
||||
#, c-format
|
||||
msgid "Failed to write attribute value, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:138
|
||||
#: ports/nrf/common-hal/bleio/Device.c:284
|
||||
#: ports/nrf/common-hal/bleio/Device.c:319
|
||||
#: ports/nrf/common-hal/bleio/Device.c:354
|
||||
#: ports/nrf/common-hal/bleio/Device.c:391
|
||||
#, c-format
|
||||
msgid "Failed to release mutex, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:81
|
||||
#: ports/nrf/common-hal/bleio/Device.c:114
|
||||
msgid "Can not fit data into the advertisment packet"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:266
|
||||
#, c-format
|
||||
msgid "Failed to discover serivices, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:403
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c:76
|
||||
#, c-format
|
||||
msgid "Failed to continue scanning, status: 0x%0xlX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:436
|
||||
#, c-format
|
||||
msgid "Failed to connect, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:513
|
||||
#, c-format
|
||||
msgid "Failed to add service, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:531
|
||||
#, c-format
|
||||
msgid "Failed to start advertisment, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:549
|
||||
#, c-format
|
||||
msgid "Failed to stop advertisment, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:575
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c:103
|
||||
#, c-format
|
||||
msgid "Failed to start scanning, status: 0x%0xlX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:592
|
||||
#, c-format
|
||||
msgid "Failed to create mutex, status: 0x%0xlX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Service.c:83
|
||||
#, c-format
|
||||
msgid "Failed to add characteristic, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/UUID.c:97
|
||||
#, c-format
|
||||
msgid "Failed to add Vendor Specific UUID, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/UUID.c:102
|
||||
msgid "Invalid UUID string length"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/UUID.c:109
|
||||
#: shared-bindings/bleio/Characteristic.c:125
|
||||
#: shared-bindings/bleio/Service.c:105
|
||||
msgid "Invalid UUID parameter"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c:96
|
||||
msgid "All I2C peripherals are in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/SPI.c:109
|
||||
#: ports/nrf/common-hal/busio/SPI.c:133
|
||||
msgid "All SPI peripherals are in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/SPI.c:170
|
||||
msgid "Baud rate too high for this SPI peripheral"
|
||||
#: ports/nrf/common-hal/busio/UART.c:48
|
||||
#, c-format
|
||||
msgid "error = 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/UART.c:43 ports/nrf/common-hal/busio/UART.c:47
|
||||
#: ports/nrf/common-hal/busio/UART.c:51 ports/nrf/common-hal/busio/UART.c:60
|
||||
#: ports/nrf/common-hal/busio/UART.c:66 ports/nrf/common-hal/busio/UART.c:71
|
||||
#: ports/nrf/common-hal/busio/UART.c:76 ports/nrf/common-hal/busio/UART.c:81
|
||||
#: ports/nrf/common-hal/busio/UART.c:86 ports/nrf/common-hal/busio/UART.c:90
|
||||
msgid "busio.UART not yet implemented"
|
||||
#: ports/nrf/common-hal/busio/UART.c:86
|
||||
msgid "Invalid buffer size"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/UART.c:90
|
||||
msgid "Odd parity is not supported"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/UART.c:322 ports/nrf/common-hal/busio/UART.c:326
|
||||
#: ports/nrf/common-hal/busio/UART.c:331 ports/nrf/common-hal/busio/UART.c:336
|
||||
#: ports/nrf/common-hal/busio/UART.c:342 ports/nrf/common-hal/busio/UART.c:347
|
||||
#: ports/nrf/common-hal/busio/UART.c:352 ports/nrf/common-hal/busio/UART.c:356
|
||||
#: ports/nrf/common-hal/busio/UART.c:364
|
||||
msgid "busio.UART not available"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/microcontroller/Processor.c:49
|
||||
@ -715,105 +833,8 @@ msgstr ""
|
||||
msgid "Can not get temperature. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:199
|
||||
msgid "Cannot apply GAP parameters."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:213
|
||||
msgid "Cannot set PPCP parameters."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:245
|
||||
msgid "Can not query for the device address."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:264
|
||||
msgid "Can not add Vendor Specific 128-bit UUID."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:284
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:298
|
||||
msgid "Can not add Service."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:373
|
||||
msgid "Can not add Characteristic."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:400
|
||||
msgid "Can not apply device name in the stack."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:464
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:514
|
||||
msgid "Can not encode UUID, to check length."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:470
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:520
|
||||
msgid "Can encode UUID into the advertisment packet."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:545
|
||||
msgid "Can not fit data into the advertisment packet."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:558
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:604
|
||||
#, c-format
|
||||
msgid "Can not apply advertisment data. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:614
|
||||
#, c-format
|
||||
msgid "Can not start advertisment. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:631
|
||||
#, c-format
|
||||
msgid "Can not stop advertisment. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:650
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:726
|
||||
#, c-format
|
||||
msgid "Can not read attribute value. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:667
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:756
|
||||
#, c-format
|
||||
msgid "Can not write attribute value. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:691
|
||||
#, c-format
|
||||
msgid "Can not notify attribute value. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:784
|
||||
#, c-format
|
||||
msgid "Can not start scanning. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:829
|
||||
#, c-format
|
||||
msgid "Can not connect. status: 0x%02x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_characteristic.c:68
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_service.c:80
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_service.c:132
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_uuid.c:137
|
||||
msgid "Invalid UUID parameter"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_service.c:73
|
||||
msgid "Invalid Service type"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_uuid.c:127
|
||||
msgid "Invalid UUID string length"
|
||||
#: ports/nrf/common-hal/pulseio/PWMOut.c:161
|
||||
msgid "All PWM peripherals are in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/unix/modffi.c:138
|
||||
@ -917,19 +938,33 @@ msgstr ""
|
||||
msgid "bad compile mode"
|
||||
msgstr ""
|
||||
|
||||
#: py/builtinimport.c:338
|
||||
#: py/builtinhelp.c:137
|
||||
msgid "Plus any modules on the filesystem\n"
|
||||
msgstr ""
|
||||
|
||||
#: py/builtinhelp.c:183
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Welcome to Adafruit CircuitPython %s!\n"
|
||||
"\n"
|
||||
"Please visit learn.adafruit.com/category/circuitpython for project guides.\n"
|
||||
"\n"
|
||||
"To list built-in modules please do `help(\"modules\")`.\n"
|
||||
msgstr ""
|
||||
|
||||
#: py/builtinimport.c:336
|
||||
msgid "cannot perform relative import"
|
||||
msgstr ""
|
||||
|
||||
#: py/builtinimport.c:422 py/builtinimport.c:534
|
||||
#: py/builtinimport.c:420 py/builtinimport.c:532
|
||||
msgid "module not found"
|
||||
msgstr ""
|
||||
|
||||
#: py/builtinimport.c:425 py/builtinimport.c:537
|
||||
#: py/builtinimport.c:423 py/builtinimport.c:535
|
||||
msgid "no module named '%q'"
|
||||
msgstr ""
|
||||
|
||||
#: py/builtinimport.c:512
|
||||
#: py/builtinimport.c:510
|
||||
msgid "relative import"
|
||||
msgstr ""
|
||||
|
||||
@ -1078,6 +1113,72 @@ msgstr ""
|
||||
msgid "'data' requires integer arguments"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:102
|
||||
msgid "can only have up to 4 parameters to Thumb assembly"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:107 py/emitinlinethumb.c:112
|
||||
msgid "parameters must be registers in sequence r0 to r3"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:188 py/emitinlinethumb.c:230
|
||||
#, c-format
|
||||
msgid "'%s' expects at most r%d"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:197 py/emitinlinextensa.c:162
|
||||
#, c-format
|
||||
msgid "'%s' expects a register"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:211
|
||||
#, c-format
|
||||
msgid "'%s' expects a special register"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:239
|
||||
#, c-format
|
||||
msgid "'%s' expects an FPU register"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:292
|
||||
#, c-format
|
||||
msgid "'%s' expects {r0, r1, ...}"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:299 py/emitinlinextensa.c:169
|
||||
#, c-format
|
||||
msgid "'%s' expects an integer"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:304
|
||||
#, c-format
|
||||
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:328
|
||||
#, c-format
|
||||
msgid "'%s' expects an address of the form [a, b]"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:334 py/emitinlinextensa.c:182
|
||||
#, c-format
|
||||
msgid "'%s' expects a label"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:345 py/emitinlinextensa.c:193
|
||||
msgid "label '%q' not defined"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:806
|
||||
#, c-format
|
||||
msgid "unsupported Thumb instruction '%s' with %d arguments"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinethumb.c:810
|
||||
msgid "branch not in range"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinextensa.c:86
|
||||
msgid "can only have up to 4 parameters to Xtensa assembly"
|
||||
msgstr ""
|
||||
@ -1086,30 +1187,11 @@ msgstr ""
|
||||
msgid "parameters must be registers in sequence a2 to a5"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinextensa.c:162
|
||||
#, c-format
|
||||
msgid "'%s' expects a register"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinextensa.c:169
|
||||
#, c-format
|
||||
msgid "'%s' expects an integer"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinextensa.c:174
|
||||
#, c-format
|
||||
msgid "'%s' integer %d is not within range %d..%d"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinextensa.c:182
|
||||
#, c-format
|
||||
msgid "'%s' expects a label"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinextensa.c:193
|
||||
msgid "label '%q' not defined"
|
||||
msgstr ""
|
||||
|
||||
#: py/emitinlinextensa.c:327
|
||||
#, c-format
|
||||
msgid "unsupported Xtensa instruction '%s' with %d arguments"
|
||||
@ -1929,7 +2011,7 @@ msgid "AnalogOut is only 16 bits. Value must be less than 65536."
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiobusio/I2SOut.c:225
|
||||
#: shared-bindings/audioio/AudioOut.c:223
|
||||
#: shared-bindings/audioio/AudioOut.c:226
|
||||
msgid "Not playing"
|
||||
msgstr ""
|
||||
|
||||
@ -1966,6 +2048,22 @@ msgid ""
|
||||
"destination buffer must be a bytearray or array of type 'B' for bit_depth = 8"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audioio/Mixer.c:94
|
||||
msgid "Invalid voice count"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audioio/Mixer.c:99
|
||||
msgid "Invalid channel count"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audioio/Mixer.c:103
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audioio/Mixer.c:107
|
||||
msgid "bits_per_sample must be 8 or 16"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audioio/RawSample.c:98
|
||||
msgid ""
|
||||
"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or "
|
||||
@ -1990,22 +2088,46 @@ msgstr ""
|
||||
msgid "Buffer must be at least length 1"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:168
|
||||
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:175
|
||||
msgid "Invalid polarity"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:172
|
||||
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:179
|
||||
msgid "Invalid phase"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:176
|
||||
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:183
|
||||
msgid "Invalid number of bits"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:341
|
||||
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:348
|
||||
msgid "buffer slices must be of equal length"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Address.c:101
|
||||
msgid "Wrong address length"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Address.c:107
|
||||
msgid "Wrong number of bytes provided"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c:210
|
||||
msgid "Can't add services in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c:226
|
||||
msgid "Can't connect in Peripheral mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c:256
|
||||
msgid "Can't change the name in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c:277 shared-bindings/bleio/Device.c:313
|
||||
msgid "Can't advertise in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/busio/I2C.c:120
|
||||
msgid "Function requires lock."
|
||||
msgstr ""
|
||||
@ -2120,7 +2242,7 @@ msgstr ""
|
||||
|
||||
#: shared-bindings/microcontroller/Pin.c:89
|
||||
#: shared-bindings/neopixel_write/__init__.c:67
|
||||
#: shared-bindings/pulseio/PulseOut.c:75
|
||||
#: shared-bindings/pulseio/PulseOut.c:76
|
||||
msgid "Expected a %q"
|
||||
msgstr ""
|
||||
|
||||
@ -2163,7 +2285,7 @@ msgstr ""
|
||||
|
||||
#: shared-bindings/pulseio/PWMOut.c:195
|
||||
msgid ""
|
||||
"PWM frequency not writeable when variable_frequency is False on construction."
|
||||
"PWM frequency not writable when variable_frequency is False on construction."
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/pulseio/PulseIn.c:275
|
||||
@ -2182,7 +2304,7 @@ msgstr ""
|
||||
msgid "Read-only"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/pulseio/PulseOut.c:134
|
||||
#: shared-bindings/pulseio/PulseOut.c:135
|
||||
msgid "Array must contain halfwords (type 'H')"
|
||||
msgstr ""
|
||||
|
||||
@ -2211,6 +2333,10 @@ msgstr ""
|
||||
msgid "RTC calibration is not supported on this board"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/socket/__init__.c:516 shared-module/network/__init__.c:81
|
||||
msgid "no available NIC"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/storage/__init__.c:77
|
||||
msgid "filesystem must provide mount method"
|
||||
msgstr ""
|
||||
@ -2235,15 +2361,15 @@ msgstr ""
|
||||
msgid "time.struct_time() takes a 9-sequence"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/time/__init__.c:169 shared-bindings/time/__init__.c:250
|
||||
#: shared-bindings/time/__init__.c:169 shared-bindings/time/__init__.c:264
|
||||
msgid "Tuple or struct_time argument required"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/time/__init__.c:174 shared-bindings/time/__init__.c:255
|
||||
#: shared-bindings/time/__init__.c:174 shared-bindings/time/__init__.c:269
|
||||
msgid "function takes exactly 9 arguments"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/time/__init__.c:226 shared-bindings/time/__init__.c:259
|
||||
#: shared-bindings/time/__init__.c:240 shared-bindings/time/__init__.c:273
|
||||
msgid "timestamp out of range for platform time_t"
|
||||
msgstr ""
|
||||
|
||||
@ -2256,6 +2382,34 @@ msgid ""
|
||||
"Object has been deinitialized and can no longer be used. Create a new object."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:47 shared-module/audioio/WaveFile.c:117
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:53 shared-module/audioio/WaveFile.c:123
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:82
|
||||
msgid "Voice index too high"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:85
|
||||
msgid "The sample's sample rate does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:88
|
||||
msgid "The sample's channel count does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:91
|
||||
msgid "The sample's bits_per_sample does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:100
|
||||
msgid "The sample's signedness does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/WaveFile.c:61
|
||||
msgid "Invalid wave file"
|
||||
msgstr ""
|
||||
@ -2276,39 +2430,31 @@ msgstr ""
|
||||
msgid "Invalid file"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/WaveFile.c:117
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/WaveFile.c:123
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/bitbangio/I2C.c:58
|
||||
msgid "Clock stretch too long"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:45
|
||||
#: shared-module/bitbangio/SPI.c:44
|
||||
msgid "Clock pin init failed."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:51
|
||||
#: shared-module/bitbangio/SPI.c:50
|
||||
msgid "MOSI pin init failed."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:62
|
||||
#: shared-module/bitbangio/SPI.c:61
|
||||
msgid "MISO pin init failed."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:122
|
||||
#: shared-module/bitbangio/SPI.c:121
|
||||
msgid "Cannot write without MOSI pin."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:177
|
||||
#: shared-module/bitbangio/SPI.c:176
|
||||
msgid "Cannot read without MISO pin."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:241
|
||||
#: shared-module/bitbangio/SPI.c:240
|
||||
msgid "Cannot transfer without MOSI and MISO pins."
|
||||
msgstr ""
|
||||
|
||||
@ -2342,6 +2488,10 @@ msgstr ""
|
||||
msgid "Only true color (24 bpp or higher) BMP supported %x"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/storage/__init__.c:155
|
||||
msgid "Cannot remount '/' when USB is active."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/struct/__init__.c:39
|
||||
msgid "'S' and 'O' are not supported format types"
|
||||
msgstr ""
|
||||
@ -2349,3 +2499,16 @@ msgstr ""
|
||||
#: shared-module/struct/__init__.c:83
|
||||
msgid "too many arguments provided with the given format"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/usb_hid/Device.c:45
|
||||
#, c-format
|
||||
msgid "Buffer incorrect size. Should be %d bytes."
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/usb_hid/Device.c:53
|
||||
msgid "USB Busy"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/usb_hid/Device.c:59
|
||||
msgid "USB Error"
|
||||
msgstr ""
|
||||
|
931
locale/es.po
931
locale/es.po
File diff suppressed because it is too large
Load Diff
631
locale/fil.po
631
locale/fil.po
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
|
||||
"POT-Creation-Date: 2018-11-09 16:20-0800\n"
|
||||
"PO-Revision-Date: 2018-08-30 23:04-0700\n"
|
||||
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
|
||||
"Language-Team: fil\n"
|
||||
@ -147,15 +147,15 @@ msgstr "abort() tinawag"
|
||||
msgid "invalid arguments"
|
||||
msgstr "mali ang mga argumento"
|
||||
|
||||
#: lib/utils/pyexec.c:97 py/builtinimport.c:253
|
||||
#: lib/utils/pyexec.c:97 py/builtinimport.c:251
|
||||
msgid "script compilation not supported"
|
||||
msgstr "script kompilasyon hindi supportado"
|
||||
|
||||
#: main.c:143
|
||||
#: main.c:154
|
||||
msgid " output:\n"
|
||||
msgstr " output:\n"
|
||||
|
||||
#: main.c:157 main.c:230
|
||||
#: main.c:168 main.c:241
|
||||
msgid ""
|
||||
"Auto-reload is on. Simply save files over USB to run them or enter REPL to "
|
||||
"disable.\n"
|
||||
@ -163,48 +163,48 @@ msgstr ""
|
||||
"Ang awtomatikong pag re-reload ay ON. i-save lamang ang mga files sa USB "
|
||||
"para patakbuhin sila o pasukin ang REPL para i-disable ito.\n"
|
||||
|
||||
#: main.c:159
|
||||
#: main.c:170
|
||||
msgid "Running in safe mode! Auto-reload is off.\n"
|
||||
msgstr "Tumatakbo sa safe mode! Awtomatikong pag re-reload ay OFF.\n"
|
||||
|
||||
#: main.c:161 main.c:232
|
||||
#: main.c:172 main.c:243
|
||||
msgid "Auto-reload is off.\n"
|
||||
msgstr "Awtomatikong pag re-reload ay OFF.\n"
|
||||
|
||||
#: main.c:175
|
||||
#: main.c:186
|
||||
msgid "Running in safe mode! Not running saved code.\n"
|
||||
msgstr "Tumatakbo sa safe mode! Hindi tumatakbo ang nai-save na code.\n"
|
||||
|
||||
#: main.c:191
|
||||
#: main.c:202
|
||||
msgid "WARNING: Your code filename has two extensions\n"
|
||||
msgstr "BABALA: Ang pangalan ng file ay may dalawang extension\n"
|
||||
|
||||
#: main.c:239
|
||||
#: main.c:250
|
||||
msgid "You requested starting safe mode by "
|
||||
msgstr "Ikaw ang humiling sa safe mode sa pamamagitan ng "
|
||||
|
||||
#: main.c:242
|
||||
#: main.c:253
|
||||
msgid "To exit, please reset the board without "
|
||||
msgstr "Para lumabas, paki-reset ang board na wala ang "
|
||||
|
||||
#: main.c:249
|
||||
#: main.c:260
|
||||
msgid ""
|
||||
"You are running in safe mode which means something really bad happened.\n"
|
||||
msgstr ""
|
||||
"Ikaw ay tumatakbo sa safe mode, ang ibig sabihin nito ay may masamang "
|
||||
"nangyari.\n"
|
||||
|
||||
#: main.c:251
|
||||
#: main.c:262
|
||||
msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n"
|
||||
msgstr "Mukhang ang core CircuitPython code ay nag-crash ng malakas. Aray!\n"
|
||||
|
||||
#: main.c:252
|
||||
#: main.c:263
|
||||
msgid "Please file an issue here with the contents of your CIRCUITPY drive:\n"
|
||||
msgstr ""
|
||||
"Mag-file ng isang isyu dito gamit ang mga nilalaman ng iyong CIRCUITPY "
|
||||
"drive:\n"
|
||||
|
||||
#: main.c:255
|
||||
#: main.c:266
|
||||
msgid ""
|
||||
"The microcontroller's power dipped. Please make sure your power supply "
|
||||
"provides\n"
|
||||
@ -212,7 +212,7 @@ msgstr ""
|
||||
"Ang kapangyarihan ng mikrokontroller ay bumaba. Mangyaring suriin ang power "
|
||||
"supply \n"
|
||||
|
||||
#: main.c:256
|
||||
#: main.c:267
|
||||
msgid ""
|
||||
"enough power for the whole circuit and press reset (after ejecting "
|
||||
"CIRCUITPY).\n"
|
||||
@ -220,17 +220,17 @@ msgstr ""
|
||||
"ay nagbibigay ng sapat na power para sa buong circuit at i-press ang reset "
|
||||
"(pagkatapos i-eject ang CIRCUITPY).\n"
|
||||
|
||||
#: main.c:260
|
||||
#: main.c:271
|
||||
msgid "Press any key to enter the REPL. Use CTRL-D to reload."
|
||||
msgstr ""
|
||||
"Pindutin ang anumang key upang ipasok ang REPL. Gamitin ang CTRL-D upang i-"
|
||||
"reload."
|
||||
|
||||
#: main.c:416
|
||||
#: main.c:429
|
||||
msgid "soft reboot\n"
|
||||
msgstr "malambot na reboot\n"
|
||||
|
||||
#: ports/atmel-samd/audio_dma.c:285
|
||||
#: ports/atmel-samd/audio_dma.c:209
|
||||
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:361
|
||||
msgid "All sync event channels in use"
|
||||
msgstr "Lahat ng sync event channels ay ginagamit"
|
||||
@ -303,12 +303,12 @@ msgid "Too many channels in sample."
|
||||
msgstr "Sobra ang channels sa sample."
|
||||
|
||||
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:339
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:417
|
||||
msgid "No DMA channel found"
|
||||
msgstr "Walang DMA channel na mahanap"
|
||||
|
||||
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:341
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:419
|
||||
msgid "Unable to allocate buffers for signed conversion"
|
||||
msgstr "Hindi ma-allocate ang buffers para sa naka-sign na conversion"
|
||||
|
||||
@ -324,43 +324,44 @@ msgstr "Tanging 8 o 16 na bit mono na may "
|
||||
msgid "sampling rate out of range"
|
||||
msgstr "pagpili ng rate wala sa sakop"
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:69
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:132
|
||||
msgid "DAC already in use"
|
||||
msgstr "Ginagamit na ang DAC"
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:73
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:136
|
||||
msgid "Right channel unsupported"
|
||||
msgstr "Hindi supportado ang kanang channel"
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:76
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:139
|
||||
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:116
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c:65
|
||||
msgid "Invalid pin"
|
||||
msgstr "Mali ang pin"
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:84
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:147
|
||||
msgid "Invalid pin for left channel"
|
||||
msgstr "Mali ang pin para sa kaliwang channel"
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:88
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:151
|
||||
msgid "Invalid pin for right channel"
|
||||
msgstr "Mali ang pin para sa kanang channel"
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:91
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:154
|
||||
msgid "Cannot output both channels on the same pin"
|
||||
msgstr "Hindi maaaring output ang mga parehong channel sa parehong pin"
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:176
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:243
|
||||
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189
|
||||
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
|
||||
#: ports/nrf/common-hal/pulseio/PulseOut.c:107
|
||||
msgid "All timers in use"
|
||||
msgstr "Lahat ng timer ginagamit"
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:218
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:285
|
||||
msgid "All event channels in use"
|
||||
msgstr "Lahat ng event channels ginagamit"
|
||||
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:297
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:375
|
||||
#, c-format
|
||||
msgid "Sample rate too high. It must be less than %d"
|
||||
msgstr ""
|
||||
@ -370,10 +371,10 @@ msgid "Not enough pins available"
|
||||
msgstr "Hindi sapat ang magagamit na pins"
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/I2C.c:78
|
||||
#: ports/atmel-samd/common-hal/busio/SPI.c:132
|
||||
#: ports/atmel-samd/common-hal/busio/SPI.c:171
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c:119
|
||||
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
|
||||
#: ports/nrf/common-hal/busio/I2C.c:77
|
||||
#: ports/nrf/common-hal/busio/I2C.c:82
|
||||
msgid "Invalid pins"
|
||||
msgstr "Mali ang pins"
|
||||
|
||||
@ -390,10 +391,12 @@ msgid "bytes > 8 bits not supported"
|
||||
msgstr "hindi sinusuportahan ang bytes > 8 bits"
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c:72
|
||||
#: ports/nrf/common-hal/busio/UART.c:82
|
||||
msgid "tx and rx cannot both be None"
|
||||
msgstr "tx at rx hindi pwedeng parehas na None"
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c:145
|
||||
#: ports/nrf/common-hal/busio/UART.c:115
|
||||
msgid "Failed to allocate RX buffer"
|
||||
msgstr "Nabigong ilaan ang RX buffer"
|
||||
|
||||
@ -402,15 +405,17 @@ msgid "Could not initialize UART"
|
||||
msgstr "Hindi ma-initialize ang UART"
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c:240
|
||||
#: ports/nrf/common-hal/busio/UART.c:149
|
||||
msgid "No RX pin"
|
||||
msgstr "Walang RX pin"
|
||||
|
||||
#: ports/atmel-samd/common-hal/busio/UART.c:294
|
||||
#: ports/nrf/common-hal/busio/UART.c:195
|
||||
msgid "No TX pin"
|
||||
msgstr "Walang TX pin"
|
||||
|
||||
#: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c:170
|
||||
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:142
|
||||
#: ports/nrf/common-hal/digitalio/DigitalInOut.c:147
|
||||
msgid "Cannot get pull while in output mode"
|
||||
msgstr "Hindi makakakuha ng pull habang nasa output mode"
|
||||
|
||||
@ -421,7 +426,8 @@ msgstr "Hindi ma-reset sa bootloader dahil walang bootloader."
|
||||
|
||||
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120
|
||||
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:369
|
||||
#: ports/nrf/common-hal/pulseio/PWMOut.c:227
|
||||
#: ports/nrf/common-hal/pulseio/PWMOut.c:119
|
||||
#: ports/nrf/common-hal/pulseio/PWMOut.c:233
|
||||
msgid "Invalid PWM frequency"
|
||||
msgstr "Mali ang PWM frequency"
|
||||
|
||||
@ -469,30 +475,10 @@ msgstr "Isang channel ng hardware interrupt ay ginagamit na"
|
||||
msgid "calibration value out of range +/-127"
|
||||
msgstr "ang halaga ng pagkakalibrate ay wala sa sakop +/-127"
|
||||
|
||||
#: ports/atmel-samd/common-hal/storage/__init__.c:48
|
||||
msgid "Cannot remount '/' when USB is active."
|
||||
msgstr "Hindi ma-remount '/' kapag aktibo ang USB."
|
||||
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c:75
|
||||
msgid "No free GCLKs"
|
||||
msgstr "Walang libreng GCLKs"
|
||||
|
||||
#: ports/atmel-samd/common-hal/usb_hid/Device.c:78
|
||||
#: ports/nrf/common-hal/usb_hid/Device.c:45
|
||||
#, c-format
|
||||
msgid "Buffer incorrect size. Should be %d bytes."
|
||||
msgstr "Mali ang size ng buffer. Dapat %d bytes."
|
||||
|
||||
#: ports/atmel-samd/common-hal/usb_hid/Device.c:82
|
||||
#: ports/nrf/common-hal/usb_hid/Device.c:53
|
||||
msgid "USB Busy"
|
||||
msgstr "Busy ang USB"
|
||||
|
||||
#: ports/atmel-samd/common-hal/usb_hid/Device.c:82
|
||||
#: ports/nrf/common-hal/usb_hid/Device.c:59
|
||||
msgid "USB Error"
|
||||
msgstr "May pagkakamali ang USB"
|
||||
|
||||
#: ports/esp8266/common-hal/analogio/AnalogIn.c:43
|
||||
msgid "Pin %q does not have ADC capabilities"
|
||||
msgstr "Walang kakayahang ADC ang pin %q"
|
||||
@ -705,133 +691,172 @@ msgstr "hindi alam na config param"
|
||||
msgid "AnalogOut functionality not supported"
|
||||
msgstr "Hindi supportado ang AnalogOut"
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c:91
|
||||
#: ports/nrf/common-hal/bleio/Adapter.c:41
|
||||
#, c-format
|
||||
msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Adapter.c:125
|
||||
#, c-format
|
||||
msgid "Failed to change softdevice state, error: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Adapter.c:135
|
||||
#, c-format
|
||||
msgid "Failed to get softdevice state, error: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Adapter.c:155
|
||||
#, c-format
|
||||
msgid "Failed to get local address, error: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:52
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to write gatts value, status: 0x%08lX"
|
||||
msgstr "Hindi maisulat ang attribute value. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:76
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to notify attribute value, status: 0x%08lX"
|
||||
msgstr "Hindi mabalitaan ang attribute value. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:91
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to read attribute value, status: 0x%08lX"
|
||||
msgstr "Hindi mabasa ang value ng attribute. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:119
|
||||
#: ports/nrf/common-hal/bleio/Device.c:272
|
||||
#: ports/nrf/common-hal/bleio/Device.c:307
|
||||
#, c-format
|
||||
msgid "Failed to acquire mutex, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:126
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to write attribute value, status: 0x%08lX"
|
||||
msgstr "Hindi maisulat ang attribute value. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c:138
|
||||
#: ports/nrf/common-hal/bleio/Device.c:284
|
||||
#: ports/nrf/common-hal/bleio/Device.c:319
|
||||
#: ports/nrf/common-hal/bleio/Device.c:354
|
||||
#: ports/nrf/common-hal/bleio/Device.c:391
|
||||
#, c-format
|
||||
msgid "Failed to release mutex, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:81
|
||||
#: ports/nrf/common-hal/bleio/Device.c:114
|
||||
#, fuzzy
|
||||
msgid "Can not fit data into the advertisment packet"
|
||||
msgstr "Hindi makasya ang data sa loob ng advertisement packet."
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:266
|
||||
#, c-format
|
||||
msgid "Failed to discover serivices, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:403
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c:76
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to continue scanning, status: 0x%0xlX"
|
||||
msgstr "Hindi masimulaan mag i-scan. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:436
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to connect, status: 0x%08lX"
|
||||
msgstr "Hindi makaconnect. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:513
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to add service, status: 0x%08lX"
|
||||
msgstr "Hindi mahinto ang advertisement. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:531
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to start advertisment, status: 0x%08lX"
|
||||
msgstr "Hindi masimulaan ang advertisement. status 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:549
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to stop advertisment, status: 0x%08lX"
|
||||
msgstr "Hindi mahinto ang advertisement. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:575
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c:103
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to start scanning, status: 0x%0xlX"
|
||||
msgstr "Hindi masimulaan mag i-scan. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c:592
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to create mutex, status: 0x%0xlX"
|
||||
msgstr "Hindi mabasa ang value ng attribute. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Service.c:83
|
||||
#, c-format
|
||||
msgid "Failed to add characteristic, status: 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/UUID.c:97
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to add Vendor Specific UUID, status: 0x%08lX"
|
||||
msgstr "Hindi maaaring magdagdag ng Vendor Specific na 128-bit UUID."
|
||||
|
||||
#: ports/nrf/common-hal/bleio/UUID.c:102
|
||||
msgid "Invalid UUID string length"
|
||||
msgstr "Mali ang UUID string length"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/UUID.c:109
|
||||
#: shared-bindings/bleio/Characteristic.c:125
|
||||
#: shared-bindings/bleio/Service.c:105
|
||||
msgid "Invalid UUID parameter"
|
||||
msgstr "Mali ang UUID parameter"
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c:96
|
||||
#, fuzzy
|
||||
msgid "All I2C peripherals are in use"
|
||||
msgstr "Lahat ng timer ginagamit"
|
||||
|
||||
#: ports/nrf/common-hal/busio/SPI.c:109
|
||||
#: ports/nrf/common-hal/busio/SPI.c:133
|
||||
#, fuzzy
|
||||
msgid "All SPI peripherals are in use"
|
||||
msgstr "Lahat ng timer ginagamit"
|
||||
|
||||
#: ports/nrf/common-hal/busio/SPI.c:170
|
||||
msgid "Baud rate too high for this SPI peripheral"
|
||||
#: ports/nrf/common-hal/busio/UART.c:48
|
||||
#, c-format
|
||||
msgid "error = 0x%08lX"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/UART.c:43 ports/nrf/common-hal/busio/UART.c:47
|
||||
#: ports/nrf/common-hal/busio/UART.c:51 ports/nrf/common-hal/busio/UART.c:60
|
||||
#: ports/nrf/common-hal/busio/UART.c:66 ports/nrf/common-hal/busio/UART.c:71
|
||||
#: ports/nrf/common-hal/busio/UART.c:76 ports/nrf/common-hal/busio/UART.c:81
|
||||
#: ports/nrf/common-hal/busio/UART.c:86 ports/nrf/common-hal/busio/UART.c:90
|
||||
msgid "busio.UART not yet implemented"
|
||||
msgstr "hindi pa implemented ang busio.UART"
|
||||
#: ports/nrf/common-hal/busio/UART.c:86
|
||||
#, fuzzy
|
||||
msgid "Invalid buffer size"
|
||||
msgstr "mali ang buffer length"
|
||||
|
||||
#: ports/nrf/common-hal/busio/UART.c:90
|
||||
#, fuzzy
|
||||
msgid "Odd parity is not supported"
|
||||
msgstr "hindi sinusuportahan ang bytes > 8 bits"
|
||||
|
||||
#: ports/nrf/common-hal/busio/UART.c:322 ports/nrf/common-hal/busio/UART.c:326
|
||||
#: ports/nrf/common-hal/busio/UART.c:331 ports/nrf/common-hal/busio/UART.c:336
|
||||
#: ports/nrf/common-hal/busio/UART.c:342 ports/nrf/common-hal/busio/UART.c:347
|
||||
#: ports/nrf/common-hal/busio/UART.c:352 ports/nrf/common-hal/busio/UART.c:356
|
||||
#: ports/nrf/common-hal/busio/UART.c:364
|
||||
msgid "busio.UART not available"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/microcontroller/Processor.c:49
|
||||
#, c-format
|
||||
msgid "Can not get temperature. status: 0x%02x"
|
||||
msgstr "Hindi makuha ang temperatura. status 0x%02x"
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:199
|
||||
msgid "Cannot apply GAP parameters."
|
||||
msgstr "Hindi ma-apply ang GAP parameters."
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:213
|
||||
msgid "Cannot set PPCP parameters."
|
||||
msgstr "Hindi ma-set ang PPCP parameters."
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:245
|
||||
msgid "Can not query for the device address."
|
||||
msgstr "Hindi maaaring mag-query para sa address ng device."
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:264
|
||||
msgid "Can not add Vendor Specific 128-bit UUID."
|
||||
msgstr "Hindi maaaring magdagdag ng Vendor Specific na 128-bit UUID."
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:284
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:298
|
||||
msgid "Can not add Service."
|
||||
msgstr "Hindi maidaragdag ang serbisyo."
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:373
|
||||
msgid "Can not add Characteristic."
|
||||
msgstr "Hindi mabasa and Characteristic."
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:400
|
||||
msgid "Can not apply device name in the stack."
|
||||
msgstr "Hindi maaaring ma-aplay ang device name sa stack."
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:464
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:514
|
||||
msgid "Can not encode UUID, to check length."
|
||||
msgstr "Hindi ma-encode UUID, para suriin ang haba."
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:470
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:520
|
||||
msgid "Can encode UUID into the advertisment packet."
|
||||
msgstr "Maaring i-encode ang UUID sa advertisement packet."
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:545
|
||||
msgid "Can not fit data into the advertisment packet."
|
||||
msgstr "Hindi makasya ang data sa loob ng advertisement packet."
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:558
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:604
|
||||
#, c-format
|
||||
msgid "Can not apply advertisment data. status: 0x%02x"
|
||||
msgstr "Hindi ma i-apply ang advertisment data. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:614
|
||||
#, c-format
|
||||
msgid "Can not start advertisment. status: 0x%02x"
|
||||
msgstr "Hindi masimulaan ang advertisement. status 0x%02x"
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:631
|
||||
#, c-format
|
||||
msgid "Can not stop advertisment. status: 0x%02x"
|
||||
msgstr "Hindi mahinto ang advertisment. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:650
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:726
|
||||
#, c-format
|
||||
msgid "Can not read attribute value. status: 0x%02x"
|
||||
msgstr "Hindi mabasa ang value ng attribute. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:667
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:756
|
||||
#, c-format
|
||||
msgid "Can not write attribute value. status: 0x%02x"
|
||||
msgstr "Hindi maisulat ang attribute value. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:691
|
||||
#, c-format
|
||||
msgid "Can not notify attribute value. status: 0x%02x"
|
||||
msgstr "Hindi mabalitaan ang attribute value. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:784
|
||||
#, c-format
|
||||
msgid "Can not start scanning. status: 0x%02x"
|
||||
msgstr "Hindi masimulaan mag i-scan. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/drivers/bluetooth/ble_drv.c:829
|
||||
#, c-format
|
||||
msgid "Can not connect. status: 0x%02x"
|
||||
msgstr "Hindi makaconnect. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_characteristic.c:68
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_service.c:80
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_service.c:132
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_uuid.c:137
|
||||
msgid "Invalid UUID parameter"
|
||||
msgstr "Mali ang UUID parameter"
|
||||
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_service.c:73
|
||||
msgid "Invalid Service type"
|
||||
msgstr "Mali ang tipo ng serbisyo"
|
||||
|
||||
#: ports/nrf/modules/ubluepy/ubluepy_uuid.c:127
|
||||
msgid "Invalid UUID string length"
|
||||
msgstr "Mali ang UUID string length"
|
||||
#: ports/nrf/common-hal/pulseio/PWMOut.c:161
|
||||
#, fuzzy
|
||||
msgid "All PWM peripherals are in use"
|
||||
msgstr "Lahat ng timer ginagamit"
|
||||
|
||||
#: ports/unix/modffi.c:138
|
||||
msgid "Unknown type"
|
||||
@ -938,19 +963,34 @@ msgstr "masamang typecode"
|
||||
msgid "bad compile mode"
|
||||
msgstr "masamang mode ng compile"
|
||||
|
||||
#: py/builtinimport.c:338
|
||||
#: py/builtinhelp.c:137
|
||||
#, fuzzy
|
||||
msgid "Plus any modules on the filesystem\n"
|
||||
msgstr "Hindi ma-remount ang filesystem"
|
||||
|
||||
#: py/builtinhelp.c:183
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Welcome to Adafruit CircuitPython %s!\n"
|
||||
"\n"
|
||||
"Please visit learn.adafruit.com/category/circuitpython for project guides.\n"
|
||||
"\n"
|
||||
"To list built-in modules please do `help(\"modules\")`.\n"
|
||||
msgstr ""
|
||||
|
||||
#: py/builtinimport.c:336
|
||||
msgid "cannot perform relative import"
|
||||
msgstr "hindi maaring isagawa ang relative import"
|
||||
|
||||
#: py/builtinimport.c:422 py/builtinimport.c:534
|
||||
#: py/builtinimport.c:420 py/builtinimport.c:532
|
||||
msgid "module not found"
|
||||
msgstr "module hindi nakita"
|
||||
|
||||
#: py/builtinimport.c:425 py/builtinimport.c:537
|
||||
#: py/builtinimport.c:423 py/builtinimport.c:535
|
||||
msgid "no module named '%q'"
|
||||
msgstr "walang module na '%q'"
|
||||
|
||||
#: py/builtinimport.c:512
|
||||
#: py/builtinimport.c:510
|
||||
msgid "relative import"
|
||||
msgstr "relative import"
|
||||
|
||||
@ -1099,6 +1139,75 @@ msgstr "'data' kailangan ng hindi bababa sa 2 argument"
|
||||
msgid "'data' requires integer arguments"
|
||||
msgstr "'data' kailangan ng integer arguments"
|
||||
|
||||
#: py/emitinlinethumb.c:102
|
||||
#, fuzzy
|
||||
msgid "can only have up to 4 parameters to Thumb assembly"
|
||||
msgstr "maaari lamang magkaroon ng hanggang 4 na parameter sa Xtensa assembly"
|
||||
|
||||
#: py/emitinlinethumb.c:107 py/emitinlinethumb.c:112
|
||||
#, fuzzy
|
||||
msgid "parameters must be registers in sequence r0 to r3"
|
||||
msgstr "ang mga parameter ay dapat na nagrerehistro sa sequence a2 hanggang a5"
|
||||
|
||||
#: py/emitinlinethumb.c:188 py/emitinlinethumb.c:230
|
||||
#, fuzzy, c-format
|
||||
msgid "'%s' expects at most r%d"
|
||||
msgstr "Inaasahan ng '%s' ang isang rehistro"
|
||||
|
||||
#: py/emitinlinethumb.c:197 py/emitinlinextensa.c:162
|
||||
#, c-format
|
||||
msgid "'%s' expects a register"
|
||||
msgstr "Inaasahan ng '%s' ang isang rehistro"
|
||||
|
||||
#: py/emitinlinethumb.c:211
|
||||
#, fuzzy, c-format
|
||||
msgid "'%s' expects a special register"
|
||||
msgstr "Inaasahan ng '%s' ang isang rehistro"
|
||||
|
||||
#: py/emitinlinethumb.c:239
|
||||
#, fuzzy, c-format
|
||||
msgid "'%s' expects an FPU register"
|
||||
msgstr "Inaasahan ng '%s' ang isang rehistro"
|
||||
|
||||
#: py/emitinlinethumb.c:292
|
||||
#, fuzzy, c-format
|
||||
msgid "'%s' expects {r0, r1, ...}"
|
||||
msgstr "Inaasahan ng '%s' ang isang rehistro"
|
||||
|
||||
#: py/emitinlinethumb.c:299 py/emitinlinextensa.c:169
|
||||
#, c-format
|
||||
msgid "'%s' expects an integer"
|
||||
msgstr "Inaasahan ng '%s' ang isang integer"
|
||||
|
||||
#: py/emitinlinethumb.c:304
|
||||
#, fuzzy, c-format
|
||||
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
|
||||
msgstr "'%s' integer %d ay wala sa sakop ng %d..%d"
|
||||
|
||||
#: py/emitinlinethumb.c:328
|
||||
#, fuzzy, c-format
|
||||
msgid "'%s' expects an address of the form [a, b]"
|
||||
msgstr "Inaasahan ng '%s' ang isang rehistro"
|
||||
|
||||
#: py/emitinlinethumb.c:334 py/emitinlinextensa.c:182
|
||||
#, c-format
|
||||
msgid "'%s' expects a label"
|
||||
msgstr "'%s' umaasa ng label"
|
||||
|
||||
#: py/emitinlinethumb.c:345 py/emitinlinextensa.c:193
|
||||
msgid "label '%q' not defined"
|
||||
msgstr "label '%d' kailangan na i-define"
|
||||
|
||||
#: py/emitinlinethumb.c:806
|
||||
#, fuzzy, c-format
|
||||
msgid "unsupported Thumb instruction '%s' with %d arguments"
|
||||
msgstr "hindi sinusuportahan ang instruction ng Xtensa '%s' sa %d argumento"
|
||||
|
||||
#: py/emitinlinethumb.c:810
|
||||
#, fuzzy
|
||||
msgid "branch not in range"
|
||||
msgstr "chr() arg wala sa sakop ng range(256)"
|
||||
|
||||
#: py/emitinlinextensa.c:86
|
||||
msgid "can only have up to 4 parameters to Xtensa assembly"
|
||||
msgstr "maaari lamang magkaroon ng hanggang 4 na parameter sa Xtensa assembly"
|
||||
@ -1107,30 +1216,11 @@ msgstr "maaari lamang magkaroon ng hanggang 4 na parameter sa Xtensa assembly"
|
||||
msgid "parameters must be registers in sequence a2 to a5"
|
||||
msgstr "ang mga parameter ay dapat na nagrerehistro sa sequence a2 hanggang a5"
|
||||
|
||||
#: py/emitinlinextensa.c:162
|
||||
#, c-format
|
||||
msgid "'%s' expects a register"
|
||||
msgstr "Inaasahan ng '%s' ang isang rehistro"
|
||||
|
||||
#: py/emitinlinextensa.c:169
|
||||
#, c-format
|
||||
msgid "'%s' expects an integer"
|
||||
msgstr "Inaasahan ng '%s' ang isang integer"
|
||||
|
||||
#: py/emitinlinextensa.c:174
|
||||
#, c-format
|
||||
msgid "'%s' integer %d is not within range %d..%d"
|
||||
msgstr "'%s' integer %d ay wala sa sakop ng %d..%d"
|
||||
|
||||
#: py/emitinlinextensa.c:182
|
||||
#, c-format
|
||||
msgid "'%s' expects a label"
|
||||
msgstr "'%s' umaasa ng label"
|
||||
|
||||
#: py/emitinlinextensa.c:193
|
||||
msgid "label '%q' not defined"
|
||||
msgstr "label '%d' kailangan na i-define"
|
||||
|
||||
#: py/emitinlinextensa.c:327
|
||||
#, c-format
|
||||
msgid "unsupported Xtensa instruction '%s' with %d arguments"
|
||||
@ -1962,7 +2052,7 @@ msgid "AnalogOut is only 16 bits. Value must be less than 65536."
|
||||
msgstr "AnalogOut ay 16 bits. Value ay dapat hindi hihigit pa sa 65536."
|
||||
|
||||
#: shared-bindings/audiobusio/I2SOut.c:225
|
||||
#: shared-bindings/audioio/AudioOut.c:223
|
||||
#: shared-bindings/audioio/AudioOut.c:226
|
||||
msgid "Not playing"
|
||||
msgstr "Hindi playing"
|
||||
|
||||
@ -2004,6 +2094,26 @@ msgstr ""
|
||||
"ang destination buffer ay dapat na isang bytearray o array ng uri na 'B' "
|
||||
"para sa bit_depth = 8"
|
||||
|
||||
#: shared-bindings/audioio/Mixer.c:94
|
||||
#, fuzzy
|
||||
msgid "Invalid voice count"
|
||||
msgstr "Mali ang tipo ng serbisyo"
|
||||
|
||||
#: shared-bindings/audioio/Mixer.c:99
|
||||
#, fuzzy
|
||||
msgid "Invalid channel count"
|
||||
msgstr "Maling argumento"
|
||||
|
||||
#: shared-bindings/audioio/Mixer.c:103
|
||||
#, fuzzy
|
||||
msgid "Sample rate must be positive"
|
||||
msgstr "Dapat aktibo ang STA"
|
||||
|
||||
#: shared-bindings/audioio/Mixer.c:107
|
||||
#, fuzzy
|
||||
msgid "bits_per_sample must be 8 or 16"
|
||||
msgstr "bits ay dapat 7, 8 o 9"
|
||||
|
||||
#: shared-bindings/audioio/RawSample.c:98
|
||||
msgid ""
|
||||
"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or "
|
||||
@ -2030,22 +2140,47 @@ msgstr "Function nangangailangan ng lock"
|
||||
msgid "Buffer must be at least length 1"
|
||||
msgstr "Buffer dapat ay hindi baba sa 1 na haba"
|
||||
|
||||
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:168
|
||||
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:175
|
||||
msgid "Invalid polarity"
|
||||
msgstr "Mali ang polarity"
|
||||
|
||||
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:172
|
||||
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:179
|
||||
msgid "Invalid phase"
|
||||
msgstr "Mali ang phase"
|
||||
|
||||
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:176
|
||||
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:183
|
||||
msgid "Invalid number of bits"
|
||||
msgstr "Mali ang bilang ng bits"
|
||||
|
||||
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:341
|
||||
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:348
|
||||
msgid "buffer slices must be of equal length"
|
||||
msgstr "aarehas na haba dapat ang buffer slices"
|
||||
|
||||
#: shared-bindings/bleio/Address.c:101
|
||||
msgid "Wrong address length"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Address.c:107
|
||||
#, fuzzy
|
||||
msgid "Wrong number of bytes provided"
|
||||
msgstr "mali ang bilang ng argumento"
|
||||
|
||||
#: shared-bindings/bleio/Device.c:210
|
||||
msgid "Can't add services in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c:226
|
||||
msgid "Can't connect in Peripheral mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c:256
|
||||
msgid "Can't change the name in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c:277 shared-bindings/bleio/Device.c:313
|
||||
msgid "Can't advertise in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/busio/I2C.c:120
|
||||
msgid "Function requires lock."
|
||||
msgstr "Kailangan ng lock ang function."
|
||||
@ -2174,7 +2309,7 @@ msgstr "walang laman ang address"
|
||||
|
||||
#: shared-bindings/microcontroller/Pin.c:89
|
||||
#: shared-bindings/neopixel_write/__init__.c:67
|
||||
#: shared-bindings/pulseio/PulseOut.c:75
|
||||
#: shared-bindings/pulseio/PulseOut.c:76
|
||||
msgid "Expected a %q"
|
||||
msgstr "Umasa ng %q"
|
||||
|
||||
@ -2216,8 +2351,9 @@ msgid ""
|
||||
msgstr "PWM duty_cycle ay dapat sa loob ng 0 at 65535 (16 bit resolution)"
|
||||
|
||||
#: shared-bindings/pulseio/PWMOut.c:195
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"PWM frequency not writeable when variable_frequency is False on construction."
|
||||
"PWM frequency not writable when variable_frequency is False on construction."
|
||||
msgstr ""
|
||||
"PWM frequency hindi maisulat kapag variable_frequency ay False sa pag buo."
|
||||
|
||||
@ -2237,7 +2373,7 @@ msgstr "index ay dapat int"
|
||||
msgid "Read-only"
|
||||
msgstr "Basahin-lamang"
|
||||
|
||||
#: shared-bindings/pulseio/PulseOut.c:134
|
||||
#: shared-bindings/pulseio/PulseOut.c:135
|
||||
msgid "Array must contain halfwords (type 'H')"
|
||||
msgstr "May halfwords (type 'H') dapat ang array"
|
||||
|
||||
@ -2266,6 +2402,10 @@ msgstr "Hindi supportado ang RTC sa board na ito"
|
||||
msgid "RTC calibration is not supported on this board"
|
||||
msgstr "RTC calibration ay hindi supportado ng board na ito"
|
||||
|
||||
#: shared-bindings/socket/__init__.c:516 shared-module/network/__init__.c:81
|
||||
msgid "no available NIC"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/storage/__init__.c:77
|
||||
msgid "filesystem must provide mount method"
|
||||
msgstr "ang filesystem dapat mag bigay ng mount method"
|
||||
@ -2290,15 +2430,15 @@ msgstr "time.struct_time() kumukuha ng 1 argument"
|
||||
msgid "time.struct_time() takes a 9-sequence"
|
||||
msgstr "time.struct_time() kumukuha ng 9-sequence"
|
||||
|
||||
#: shared-bindings/time/__init__.c:169 shared-bindings/time/__init__.c:250
|
||||
#: shared-bindings/time/__init__.c:169 shared-bindings/time/__init__.c:264
|
||||
msgid "Tuple or struct_time argument required"
|
||||
msgstr "Tuple o struct_time argument kailangan"
|
||||
|
||||
#: shared-bindings/time/__init__.c:174 shared-bindings/time/__init__.c:255
|
||||
#: shared-bindings/time/__init__.c:174 shared-bindings/time/__init__.c:269
|
||||
msgid "function takes exactly 9 arguments"
|
||||
msgstr "function kumukuha ng 9 arguments"
|
||||
|
||||
#: shared-bindings/time/__init__.c:226 shared-bindings/time/__init__.c:259
|
||||
#: shared-bindings/time/__init__.c:240 shared-bindings/time/__init__.c:273
|
||||
msgid "timestamp out of range for platform time_t"
|
||||
msgstr "wala sa sakop ng timestamp ang platform time_t"
|
||||
|
||||
@ -2313,6 +2453,34 @@ msgstr ""
|
||||
"Object ay deinitialized at hindi na magagamit. Lumikha ng isang bagong "
|
||||
"Object."
|
||||
|
||||
#: shared-module/audioio/Mixer.c:47 shared-module/audioio/WaveFile.c:117
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr "Hindi ma-iallocate ang first buffer"
|
||||
|
||||
#: shared-module/audioio/Mixer.c:53 shared-module/audioio/WaveFile.c:123
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr "Hindi ma-iallocate ang second buffer"
|
||||
|
||||
#: shared-module/audioio/Mixer.c:82
|
||||
msgid "Voice index too high"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:85
|
||||
msgid "The sample's sample rate does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:88
|
||||
msgid "The sample's channel count does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:91
|
||||
msgid "The sample's bits_per_sample does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/Mixer.c:100
|
||||
msgid "The sample's signedness does not match the mixer's"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/audioio/WaveFile.c:61
|
||||
msgid "Invalid wave file"
|
||||
msgstr "May hindi tama sa wave file"
|
||||
@ -2333,39 +2501,31 @@ msgstr "Dapat sunurin ng Data chunk ang fmt chunk"
|
||||
msgid "Invalid file"
|
||||
msgstr "Mali ang file"
|
||||
|
||||
#: shared-module/audioio/WaveFile.c:117
|
||||
msgid "Couldn't allocate first buffer"
|
||||
msgstr "Hindi ma-iallocate ang first buffer"
|
||||
|
||||
#: shared-module/audioio/WaveFile.c:123
|
||||
msgid "Couldn't allocate second buffer"
|
||||
msgstr "Hindi ma-iallocate ang second buffer"
|
||||
|
||||
#: shared-module/bitbangio/I2C.c:58
|
||||
msgid "Clock stretch too long"
|
||||
msgstr "Masyadong mahaba ang Clock stretch"
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:45
|
||||
#: shared-module/bitbangio/SPI.c:44
|
||||
msgid "Clock pin init failed."
|
||||
msgstr "Nabigo sa pag init ng Clock pin."
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:51
|
||||
#: shared-module/bitbangio/SPI.c:50
|
||||
msgid "MOSI pin init failed."
|
||||
msgstr "Hindi ma-initialize ang MOSI pin."
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:62
|
||||
#: shared-module/bitbangio/SPI.c:61
|
||||
msgid "MISO pin init failed."
|
||||
msgstr "Hindi ma-initialize ang MISO pin."
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:122
|
||||
#: shared-module/bitbangio/SPI.c:121
|
||||
msgid "Cannot write without MOSI pin."
|
||||
msgstr "Hindi maaring isulat kapag walang MOSI pin."
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:177
|
||||
#: shared-module/bitbangio/SPI.c:176
|
||||
msgid "Cannot read without MISO pin."
|
||||
msgstr "Hindi maaring mabasa kapag walang MISO pin."
|
||||
|
||||
#: shared-module/bitbangio/SPI.c:241
|
||||
#: shared-module/bitbangio/SPI.c:240
|
||||
msgid "Cannot transfer without MOSI and MISO pins."
|
||||
msgstr "Hindi maaaring ilipat kapag walang MOSI at MISO pin."
|
||||
|
||||
@ -2401,6 +2561,10 @@ msgstr ""
|
||||
msgid "Only true color (24 bpp or higher) BMP supported %x"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/storage/__init__.c:155
|
||||
msgid "Cannot remount '/' when USB is active."
|
||||
msgstr "Hindi ma-remount '/' kapag aktibo ang USB."
|
||||
|
||||
#: shared-module/struct/__init__.c:39
|
||||
msgid "'S' and 'O' are not supported format types"
|
||||
msgstr "Ang 'S' at 'O' ay hindi suportadong uri ng format"
|
||||
@ -2409,6 +2573,49 @@ msgstr "Ang 'S' at 'O' ay hindi suportadong uri ng format"
|
||||
msgid "too many arguments provided with the given format"
|
||||
msgstr "masyadong maraming mga argumento na ibinigay sa ibinigay na format"
|
||||
|
||||
#: shared-module/usb_hid/Device.c:45
|
||||
#, c-format
|
||||
msgid "Buffer incorrect size. Should be %d bytes."
|
||||
msgstr "Mali ang size ng buffer. Dapat %d bytes."
|
||||
|
||||
#: shared-module/usb_hid/Device.c:53
|
||||
msgid "USB Busy"
|
||||
msgstr "Busy ang USB"
|
||||
|
||||
#: shared-module/usb_hid/Device.c:59
|
||||
msgid "USB Error"
|
||||
msgstr "May pagkakamali ang USB"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "palette must be displayio.Palette"
|
||||
#~ msgstr "ang palette ay dapat 32 bytes ang haba"
|
||||
|
||||
#~ msgid "Invalid Service type"
|
||||
#~ msgstr "Mali ang tipo ng serbisyo"
|
||||
|
||||
#~ msgid "Can encode UUID into the advertisement packet."
|
||||
#~ msgstr "Maaring i-encode ang UUID sa advertisement packet."
|
||||
|
||||
#~ msgid "Can not encode UUID, to check length."
|
||||
#~ msgstr "Hindi ma-encode UUID, para suriin ang haba."
|
||||
|
||||
#~ msgid "Can not query for the device address."
|
||||
#~ msgstr "Hindi maaaring mag-query para sa address ng device."
|
||||
|
||||
#~ msgid "Can not apply advertisement data. status: 0x%02x"
|
||||
#~ msgstr "Hindi ma i-apply ang advertisement data. status: 0x%02x"
|
||||
|
||||
#~ msgid "Can not apply device name in the stack."
|
||||
#~ msgstr "Hindi maaaring ma-aplay ang device name sa stack."
|
||||
|
||||
#~ msgid "Can not add Characteristic."
|
||||
#~ msgstr "Hindi mabasa and Characteristic."
|
||||
|
||||
#~ msgid "Cannot apply GAP parameters."
|
||||
#~ msgstr "Hindi ma-apply ang GAP parameters."
|
||||
|
||||
#~ msgid "Cannot set PPCP parameters."
|
||||
#~ msgstr "Hindi ma-set ang PPCP parameters."
|
||||
|
||||
#~ msgid "Can not add Service."
|
||||
#~ msgstr "Hindi maidaragdag ang serbisyo."
|
||||
|
651
locale/fr.po
651
locale/fr.po
File diff suppressed because it is too large
Load Diff
2602
locale/it_IT.po
Normal file
2602
locale/it_IT.po
Normal file
File diff suppressed because it is too large
Load Diff
2554
locale/pt_BR.po
Normal file
2554
locale/pt_BR.po
Normal file
File diff suppressed because it is too large
Load Diff
18
main.c
18
main.c
@ -51,9 +51,14 @@
|
||||
#include "supervisor/shared/autoreload.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
#include "supervisor/shared/rgb_led_status.h"
|
||||
#include "supervisor/shared/status_leds.h"
|
||||
#include "supervisor/shared/stack.h"
|
||||
#include "supervisor/serial.h"
|
||||
|
||||
#ifdef MICROPY_PY_NETWORK
|
||||
#include "shared-module/network/__init__.h"
|
||||
#endif
|
||||
|
||||
void do_str(const char *src, mp_parse_input_kind_t input_kind) {
|
||||
mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0);
|
||||
if (lex == NULL) {
|
||||
@ -103,15 +108,22 @@ void start_mp(supervisor_allocation* heap) {
|
||||
mp_obj_list_init(mp_sys_path, 0);
|
||||
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_)); // current dir (or base dir of the script)
|
||||
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_));
|
||||
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_lib));
|
||||
// Frozen modules are in their own pseudo-dir, e.g., ".frozen".
|
||||
// Prioritize .frozen over /lib.
|
||||
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_FROZEN_FAKE_DIR_QSTR));
|
||||
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_lib));
|
||||
|
||||
mp_obj_list_init(mp_sys_argv, 0);
|
||||
|
||||
#if MICROPY_PY_NETWORK
|
||||
network_module_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
void stop_mp(void) {
|
||||
|
||||
#if MICROPY_PY_NETWORK
|
||||
network_module_deinit();
|
||||
#endif
|
||||
}
|
||||
|
||||
#define STRING_LIST(...) {__VA_ARGS__, ""}
|
||||
@ -378,6 +390,8 @@ int __attribute__((used)) main(void) {
|
||||
// initialise the cpu and peripherals
|
||||
safe_mode_t safe_mode = port_init();
|
||||
|
||||
// Turn on LEDs
|
||||
init_status_leds();
|
||||
rgb_led_status_init();
|
||||
|
||||
stack_init();
|
||||
|
@ -45,16 +45,13 @@ INC += -I. \
|
||||
-Iasf4/$(CHIP_FAMILY)/hpl/tc \
|
||||
-Iasf4/$(CHIP_FAMILY)/include \
|
||||
-Iasf4/$(CHIP_FAMILY)/CMSIS/Include \
|
||||
-Iasf4/$(CHIP_FAMILY)/usb \
|
||||
-Iasf4/$(CHIP_FAMILY)/usb/class/cdc \
|
||||
-Iasf4/$(CHIP_FAMILY)/usb/class/hid \
|
||||
-Iasf4/$(CHIP_FAMILY)/usb/class/msc \
|
||||
-Iasf4/$(CHIP_FAMILY)/usb/device \
|
||||
-Iasf4_conf/$(CHIP_FAMILY) \
|
||||
-Iboards/$(BOARD) \
|
||||
-Iboards/ \
|
||||
-Iperipherals/ \
|
||||
-Ifreetouch \
|
||||
-I../../lib/tinyusb/src \
|
||||
-I../../supervisor/shared/usb \
|
||||
-I$(BUILD)
|
||||
|
||||
BASE_CFLAGS = \
|
||||
@ -64,7 +61,6 @@ BASE_CFLAGS = \
|
||||
-Wno-endif-labels \
|
||||
-Wstrict-prototypes \
|
||||
-Werror-implicit-function-declaration \
|
||||
-Wpointer-arith \
|
||||
-Wfloat-equal \
|
||||
-Wundef \
|
||||
-Wshadow \
|
||||
@ -72,7 +68,6 @@ BASE_CFLAGS = \
|
||||
-Wsign-compare \
|
||||
-Wmissing-format-attribute \
|
||||
-Wno-deprecated-declarations \
|
||||
-Wpacked \
|
||||
-Wnested-externs \
|
||||
-Wunreachable-code \
|
||||
-Wcast-align \
|
||||
@ -90,11 +85,15 @@ BASE_CFLAGS = \
|
||||
# NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt.
|
||||
|
||||
ifeq ($(CHIP_FAMILY), samd21)
|
||||
CFLAGS = -Os -DNDEBUG
|
||||
CFLAGS += -Os -DNDEBUG
|
||||
# TinyUSB defines
|
||||
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD21 -DCFG_TUD_CDC_RX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=128 -DCFG_TUD_MSC_BUFSIZE=512
|
||||
endif
|
||||
|
||||
ifeq ($(CHIP_FAMILY), samd51)
|
||||
CFLAGS = -Os -DNDEBUG
|
||||
CFLAGS += -Os -DNDEBUG
|
||||
# TinyUSB defines
|
||||
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
|
||||
endif
|
||||
|
||||
#Debugging/Optimization
|
||||
@ -104,7 +103,7 @@ ifeq ($(DEBUG), 1)
|
||||
# You may want to disable -flto if it interferes with debugging.
|
||||
CFLAGS += -flto
|
||||
# You may want to enable these flags to make setting breakpoints easier.
|
||||
## CFLAGS += -fno-inline -fno-ipa-sra
|
||||
# CFLAGS += -fno-inline -fno-ipa-sra
|
||||
ifeq ($(CHIP_FAMILY), samd21)
|
||||
CFLAGS += -DENABLE_MICRO_TRACE_BUFFER
|
||||
endif
|
||||
@ -123,7 +122,6 @@ endif
|
||||
|
||||
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT)
|
||||
|
||||
|
||||
ifeq ($(CHIP_FAMILY), samd21)
|
||||
CFLAGS += \
|
||||
-mthumb \
|
||||
@ -205,7 +203,6 @@ SRC_ASF := \
|
||||
hal/src/hal_spi_m_sync.c \
|
||||
hal/src/hal_timer.c \
|
||||
hal/src/hal_usart_async.c \
|
||||
hal/src/hal_usb_device.c \
|
||||
hpl/adc/hpl_adc.c \
|
||||
hpl/core/hpl_init.c \
|
||||
hpl/dac/hpl_dac.c \
|
||||
@ -215,12 +212,6 @@ SRC_ASF := \
|
||||
hpl/rtc/hpl_rtc.c \
|
||||
hpl/sercom/hpl_sercom.c \
|
||||
hpl/systick/hpl_systick.c \
|
||||
hpl/usb/hpl_usb.c \
|
||||
usb/class/cdc/device/cdcdf_acm.c \
|
||||
usb/class/hid/device/hiddf_generic.c \
|
||||
usb/class/msc/device/mscdf.c \
|
||||
usb/device/usbdc.c \
|
||||
usb/usb_protocol.c \
|
||||
hal/utils/src/utils_list.c \
|
||||
hal/utils/src/utils_ringbuffer.c \
|
||||
|
||||
@ -247,7 +238,6 @@ SRC_C = \
|
||||
board_busses.c \
|
||||
background.c \
|
||||
fatfs_port.c \
|
||||
flash_api.c \
|
||||
mphalport.c \
|
||||
reset.c \
|
||||
peripherals/samd/clocks.c \
|
||||
@ -266,8 +256,6 @@ SRC_C = \
|
||||
peripherals/samd/$(CHIP_FAMILY)/sercom.c \
|
||||
peripherals/samd/$(CHIP_FAMILY)/timers.c \
|
||||
tick.c \
|
||||
usb.c \
|
||||
usb_mass_storage.c \
|
||||
bindings/samd/__init__.c \
|
||||
bindings/samd/Clock.c \
|
||||
boards/$(BOARD)/board.c \
|
||||
@ -275,6 +263,8 @@ SRC_C = \
|
||||
lib/oofatfs/ff.c \
|
||||
lib/oofatfs/option/ccsbcs.c \
|
||||
lib/timeutils/timeutils.c \
|
||||
lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/dcd_$(CHIP_FAMILY).c \
|
||||
lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/hal_$(CHIP_FAMILY).c \
|
||||
lib/utils/buffer_helper.c \
|
||||
lib/utils/context_manager_helpers.c \
|
||||
lib/utils/interrupt_char.c \
|
||||
@ -283,22 +273,28 @@ SRC_C = \
|
||||
lib/utils/sys_stdio_mphal.c \
|
||||
lib/libc/string0.c \
|
||||
lib/mp-readline/readline.c \
|
||||
$(BUILD)/autogen_usb_descriptor.c \
|
||||
freetouch/adafruit_ptc.c \
|
||||
supervisor/shared/memory.c
|
||||
|
||||
# Choose which flash filesystem impl to use.
|
||||
# (Right now INTERNAL_FLASH_FILESYSTEM and SPI_FLASH_FILESYSTEM are mutually exclusive.
|
||||
# But that might not be true in the future.)
|
||||
ifeq ($(INTERNAL_FLASH_FILESYSTEM),1)
|
||||
SRC_C += internal_flash.c
|
||||
endif
|
||||
ifeq ($(SPI_FLASH_FILESYSTEM),1)
|
||||
SRC_C += external_flash/external_flash.c external_flash/spi_flash.c
|
||||
endif
|
||||
ifeq ($(QSPI_FLASH_FILESYSTEM),1)
|
||||
SRC_C += external_flash/external_flash.c external_flash/qspi_flash.c
|
||||
endif
|
||||
ifeq ($(MICROPY_PY_NETWORK),1)
|
||||
CFLAGS += -DMICROPY_PY_NETWORK=1
|
||||
|
||||
SRC_MOD += lib/netutils/netutils.c
|
||||
|
||||
ifneq ($(MICROPY_PY_WIZNET5K),0)
|
||||
WIZNET5K_DIR=drivers/wiznet5k
|
||||
INC += -I$(TOP)/$(WIZNET5K_DIR)
|
||||
CFLAGS_MOD += -DMICROPY_PY_WIZNET5K=$(MICROPY_PY_WIZNET5K) -D_WIZCHIP_=$(MICROPY_PY_WIZNET5K)
|
||||
SRC_MOD += $(addprefix $(WIZNET5K_DIR)/,\
|
||||
ethernet/w$(MICROPY_PY_WIZNET5K)/w$(MICROPY_PY_WIZNET5K).c \
|
||||
ethernet/wizchip_conf.c \
|
||||
ethernet/socket.c \
|
||||
internet/dns/dns.c \
|
||||
internet/dhcp/dhcp.c \
|
||||
)
|
||||
|
||||
endif # MICROPY_PY_WIZNET5K
|
||||
endif # MICROPY_PY_NETWORK
|
||||
|
||||
SRC_COMMON_HAL = \
|
||||
board/__init__.c \
|
||||
@ -320,7 +316,6 @@ SRC_COMMON_HAL = \
|
||||
rotaryio/IncrementalEncoder.c \
|
||||
rtc/__init__.c \
|
||||
rtc/RTC.c \
|
||||
storage/__init__.c \
|
||||
supervisor/__init__.c \
|
||||
supervisor/Runtime.c \
|
||||
time/__init__.c \
|
||||
@ -333,10 +328,8 @@ SRC_COMMON_HAL = \
|
||||
pulseio/PulseIn.c \
|
||||
pulseio/PulseOut.c \
|
||||
pulseio/PWMOut.c \
|
||||
usb_hid/__init__.c \
|
||||
usb_hid/Device.c \
|
||||
touchio/__init__.c \
|
||||
touchio/TouchIn.c \
|
||||
touchio/TouchIn.c
|
||||
|
||||
ifeq ($(INTERNAL_LIBM),1)
|
||||
SRC_LIBM = $(addprefix lib/,\
|
||||
@ -362,7 +355,6 @@ SRC_LIBM = $(addprefix lib/,\
|
||||
)
|
||||
endif
|
||||
|
||||
|
||||
# These don't have corresponding files in each port but are still located in
|
||||
# shared-bindings to make it clear what the contents of the modules are.
|
||||
SRC_BINDINGS_ENUMS = \
|
||||
@ -394,12 +386,24 @@ SRC_SHARED_MODULE = \
|
||||
_stage/__init__.c \
|
||||
_stage/Layer.c \
|
||||
_stage/Text.c \
|
||||
storage/__init__.c \
|
||||
os/__init__.c \
|
||||
random/__init__.c \
|
||||
storage/__init__.c \
|
||||
struct/__init__.c \
|
||||
uheap/__init__.c \
|
||||
ustack/__init__.c
|
||||
ustack/__init__.c \
|
||||
usb_hid/__init__.c \
|
||||
usb_hid/Device.c
|
||||
|
||||
# usb_midi/__init__.c
|
||||
# usb_midi/Port.c
|
||||
|
||||
ifeq ($(MICROPY_PY_NETWORK),1)
|
||||
SRC_SHARED_MODULE += socket/__init__.c network/__init__.c
|
||||
ifneq ($(MICROPY_PY_WIZNET5K),0)
|
||||
SRC_SHARED_MODULE += wiznet/__init__.c wiznet/wiznet5k.c
|
||||
endif
|
||||
endif
|
||||
|
||||
# SAMRs don't have a DAC
|
||||
ifneq ($(CHIP_VARIANT),SAMR21G18A)
|
||||
@ -407,6 +411,8 @@ ifneq ($(CHIP_VARIANT),SAMR21G18A)
|
||||
audioio/__init__.c \
|
||||
audioio/AudioOut.c
|
||||
SRC_SHARED_MODULE += \
|
||||
audioio/__init__.c \
|
||||
audioio/Mixer.c \
|
||||
audioio/RawSample.c \
|
||||
audioio/WaveFile.c
|
||||
endif
|
||||
@ -441,6 +447,7 @@ ifeq ($(INTERNAL_LIBM),1)
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_LIBM:.c=.o))
|
||||
endif
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
|
||||
|
||||
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED) $(STM_SRC_C)
|
||||
# Sources that only hold QSTRs after pre-processing.
|
||||
@ -461,21 +468,6 @@ $(BUILD)/firmware.uf2: $(BUILD)/firmware.bin
|
||||
$(STEPECHO) "Create $@"
|
||||
$(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -c -o $@ $^
|
||||
|
||||
$(BUILD)/autogen_usb_descriptor.c $(BUILD)/genhdr/autogen_usb_descriptor.h: autogen_usb_descriptor.intermediate
|
||||
|
||||
.INTERMEDIATE: autogen_usb_descriptor.intermediate
|
||||
|
||||
autogen_usb_descriptor.intermediate: tools/gen_usb_descriptor.py Makefile | $(HEADER_BUILD)
|
||||
$(STEPECHO) "GEN $@"
|
||||
$(Q)install -d $(BUILD)/genhdr
|
||||
$(Q)$(PYTHON3) tools/gen_usb_descriptor.py \
|
||||
--manufacturer $(USB_MANUFACTURER)\
|
||||
--product $(USB_PRODUCT)\
|
||||
--vid $(USB_VID)\
|
||||
--pid $(USB_PID)\
|
||||
--output_c_file $(BUILD)/autogen_usb_descriptor.c\
|
||||
--output_h_file $(BUILD)/genhdr/autogen_usb_descriptor.h
|
||||
|
||||
deploy: $(BUILD)/firmware.bin
|
||||
$(ECHO) "Writing $< to the board"
|
||||
$(BOSSAC) -u $<
|
||||
|
@ -40,82 +40,6 @@ static audio_dma_t* audio_dma_state[AUDIO_DMA_CHANNEL_COUNT];
|
||||
// This cannot be in audio_dma_state because it's volatile.
|
||||
static volatile bool audio_dma_pending[AUDIO_DMA_CHANNEL_COUNT];
|
||||
|
||||
uint32_t audiosample_sample_rate(mp_obj_t sample_obj) {
|
||||
if (MP_OBJ_IS_TYPE(sample_obj, &audioio_rawsample_type)) {
|
||||
audioio_rawsample_obj_t* sample = MP_OBJ_TO_PTR(sample_obj);
|
||||
return sample->sample_rate;
|
||||
}
|
||||
if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
|
||||
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
return file->sample_rate;
|
||||
}
|
||||
return 16000;
|
||||
}
|
||||
|
||||
uint8_t audiosample_bits_per_sample(mp_obj_t sample_obj) {
|
||||
if (MP_OBJ_IS_TYPE(sample_obj, &audioio_rawsample_type)) {
|
||||
audioio_rawsample_obj_t* sample = MP_OBJ_TO_PTR(sample_obj);
|
||||
return sample->bits_per_sample;
|
||||
}
|
||||
if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
|
||||
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
return file->bits_per_sample;
|
||||
}
|
||||
return 8;
|
||||
}
|
||||
|
||||
uint8_t audiosample_channel_count(mp_obj_t sample_obj) {
|
||||
if (MP_OBJ_IS_TYPE(sample_obj, &audioio_rawsample_type)) {
|
||||
audioio_rawsample_obj_t* sample = MP_OBJ_TO_PTR(sample_obj);
|
||||
return sample->channel_count;
|
||||
}
|
||||
if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
|
||||
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
return file->channel_count;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void audiosample_reset_buffer(mp_obj_t sample_obj, bool single_channel, uint8_t audio_channel) {
|
||||
if (MP_OBJ_IS_TYPE(sample_obj, &audioio_rawsample_type)) {
|
||||
audioio_rawsample_obj_t* sample = MP_OBJ_TO_PTR(sample_obj);
|
||||
audioio_rawsample_reset_buffer(sample, single_channel, audio_channel);
|
||||
}
|
||||
if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
|
||||
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
audioio_wavefile_reset_buffer(file, single_channel, audio_channel);
|
||||
}
|
||||
}
|
||||
|
||||
static audioio_get_buffer_result_t audiosample_get_buffer(mp_obj_t sample_obj,
|
||||
bool single_channel,
|
||||
uint8_t channel,
|
||||
uint8_t** buffer, uint32_t* buffer_length) {
|
||||
if (MP_OBJ_IS_TYPE(sample_obj, &audioio_rawsample_type)) {
|
||||
audioio_rawsample_obj_t* sample = MP_OBJ_TO_PTR(sample_obj);
|
||||
return audioio_rawsample_get_buffer(sample, single_channel, channel, buffer, buffer_length);
|
||||
}
|
||||
if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
|
||||
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
return audioio_wavefile_get_buffer(file, single_channel, channel, buffer, buffer_length);
|
||||
}
|
||||
return GET_BUFFER_DONE;
|
||||
}
|
||||
|
||||
static void audiosample_get_buffer_structure(mp_obj_t sample_obj, bool single_channel,
|
||||
bool* single_buffer, bool* samples_signed,
|
||||
uint32_t* max_buffer_length, uint8_t* spacing) {
|
||||
if (MP_OBJ_IS_TYPE(sample_obj, &audioio_rawsample_type)) {
|
||||
audioio_rawsample_obj_t* sample = MP_OBJ_TO_PTR(sample_obj);
|
||||
audioio_rawsample_get_buffer_structure(sample, single_channel, single_buffer,
|
||||
samples_signed, max_buffer_length, spacing);
|
||||
} else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
|
||||
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
|
||||
audioio_wavefile_get_buffer_structure(file, single_channel, single_buffer, samples_signed,
|
||||
max_buffer_length, spacing);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t find_free_audio_dma_channel(void) {
|
||||
uint8_t channel;
|
||||
for (channel = 0; channel < AUDIO_DMA_CHANNEL_COUNT; channel++) {
|
||||
|
@ -27,10 +27,10 @@
|
||||
|
||||
#include "audio_dma.h"
|
||||
#include "tick.h"
|
||||
#include "usb.h"
|
||||
#include "usb_mass_storage.h"
|
||||
#include "supervisor/usb.h"
|
||||
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/network/__init__.h"
|
||||
|
||||
volatile uint64_t last_finished_tick = 0;
|
||||
|
||||
@ -41,8 +41,11 @@ void run_background_tasks(void) {
|
||||
#ifdef CIRCUITPY_DISPLAYIO
|
||||
displayio_refresh_display();
|
||||
#endif
|
||||
usb_msc_background();
|
||||
usb_cdc_background();
|
||||
#if MICROPY_PY_NETWORK
|
||||
network_module_background();
|
||||
#endif
|
||||
usb_background();
|
||||
|
||||
last_finished_tick = ticks_ms;
|
||||
}
|
||||
|
||||
|
@ -23,14 +23,18 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_FLASH_API_H
|
||||
#define MICROPY_INCLUDED_ATMEL_SAMD_FLASH_API_H
|
||||
|
||||
#include "extmod/vfs_fat.h"
|
||||
#include "boards/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "hal/include/hal_gpio.h"
|
||||
|
||||
extern void flash_init_vfs(fs_user_mount_t *vfs);
|
||||
extern void flash_flush(void);
|
||||
void board_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
void flash_set_usb_writable(bool usb_writable);
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // MICROPY_INCLUDED_ATMEL_SAMD_FLASH_API_H
|
||||
void reset_board(void) {
|
||||
}
|
24
ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.h
Normal file
24
ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.h
Normal file
@ -0,0 +1,24 @@
|
||||
#define MICROPY_HW_BOARD_NAME "Arduino MKR1300"
|
||||
#define MICROPY_HW_MCU_NAME "samd21g18"
|
||||
|
||||
#define MICROPY_PORT_A (0)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA09)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA08)
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_PA13)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_PA12)
|
||||
#define DEFAULT_SPI_BUS_MISO (&pin_PA15)
|
||||
|
||||
#define DEFAULT_UART_BUS_RX (&pin_PB23)
|
||||
#define DEFAULT_UART_BUS_TX (&pin_PB22)
|
||||
|
||||
// USB is always used internally so skip the pin objects for it.
|
||||
#define IGNORE_PIN_PA24 1
|
||||
#define IGNORE_PIN_PA25 1
|
11
ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk
Normal file
11
ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk
Normal file
@ -0,0 +1,11 @@
|
||||
LD_FILE = boards/samd21x18-bootloader.ld
|
||||
USB_VID = 0x2341
|
||||
USB_PID = 0x8053
|
||||
USB_PRODUCT = "Arduino MKR1300"
|
||||
USB_MANUFACTURER = "Arduino"
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
44
ports/atmel-samd/boards/arduino_mkr1300/pins.c
Normal file
44
ports/atmel-samd/boards/arduino_mkr1300/pins.c
Normal file
@ -0,0 +1,44 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA22) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB23) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA23) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB22) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PB10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PB11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA19) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB23) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB22) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_PB09) }, // NOTE: LORA BOOT
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RFM9X_RST), MP_ROM_PTR(&pin_PA27) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RFM9X_CS), MP_ROM_PTR(&pin_PA14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PB08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PB08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
@ -30,13 +30,6 @@
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
gpio_set_pin_function(MICROPY_HW_LED_TX, GPIO_PIN_FUNCTION_OFF);
|
||||
gpio_set_pin_direction(MICROPY_HW_LED_TX, GPIO_DIRECTION_OUT);
|
||||
gpio_set_pin_level(MICROPY_HW_LED_TX, true);
|
||||
|
||||
gpio_set_pin_function(MICROPY_HW_LED_RX, GPIO_PIN_FUNCTION_OFF);
|
||||
gpio_set_pin_direction(MICROPY_HW_LED_RX, GPIO_DIRECTION_OUT);
|
||||
gpio_set_pin_level(MICROPY_HW_LED_RX, true);
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -1,16 +1,14 @@
|
||||
#define MICROPY_HW_BOARD_NAME "Arduino Zero"
|
||||
#define MICROPY_HW_MCU_NAME "samd21g18"
|
||||
|
||||
// #define MICROPY_HW_LED_MSC PIN_PA17 // red
|
||||
#define MICROPY_HW_LED_TX PIN_PA27
|
||||
#define MICROPY_HW_LED_RX PIN_PB03
|
||||
// #define MICROPY_HW_LED_MSC &pin_PA17 // red
|
||||
#define MICROPY_HW_LED_TX &pin_PA27
|
||||
#define MICROPY_HW_LED_RX &pin_PB03
|
||||
|
||||
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25 | PORT_PA27)
|
||||
#define MICROPY_PORT_A (PORT_PA27)
|
||||
#define MICROPY_PORT_B (PORT_PB03)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#include "internal_flash.h"
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 hathach for Adafruit Industries
|
||||
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -24,11 +24,15 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_NRF_USB_H
|
||||
#define MICROPY_INCLUDED_NRF_USB_H
|
||||
#include "boards/board.h"
|
||||
|
||||
#include "tusb.h"
|
||||
void board_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
void usb_init(void);
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // MICROPY_INCLUDED_NRF_USB_H
|
||||
void reset_board(void) {
|
||||
}
|
58
ports/atmel-samd/boards/catwan_usbstick/mpconfigboard.h
Normal file
58
ports/atmel-samd/boards/catwan_usbstick/mpconfigboard.h
Normal file
@ -0,0 +1,58 @@
|
||||
#define MICROPY_HW_BOARD_NAME "Electronic Cats CatWAN USBStick"
|
||||
#define MICROPY_HW_MCU_NAME "samd21e18"
|
||||
|
||||
#define MICROPY_HW_LED_RX &pin_PA14
|
||||
|
||||
#define MICROPY_PORT_A (PORT_PA14)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_PA19)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_PA18)
|
||||
#define DEFAULT_SPI_BUS_MISO (&pin_PA22)
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
|
||||
#define IGNORE_PIN_PA00 1
|
||||
#define IGNORE_PIN_PA01 1
|
||||
#define IGNORE_PIN_PA02 1
|
||||
#define IGNORE_PIN_PA03 1
|
||||
#define IGNORE_PIN_PA05 1
|
||||
#define IGNORE_PIN_PA06 1
|
||||
#define IGNORE_PIN_PA07 1
|
||||
#define IGNORE_PIN_PA08 1
|
||||
#define IGNORE_PIN_PA09 1
|
||||
#define IGNORE_PIN_PA10 1
|
||||
#define IGNORE_PIN_PA11 1
|
||||
#define IGNORE_PIN_PA12 1
|
||||
#define IGNORE_PIN_PA13 1
|
||||
#define IGNORE_PIN_PA20 1
|
||||
#define IGNORE_PIN_PA21 1
|
||||
// USB is always used.
|
||||
#define IGNORE_PIN_PA24 1
|
||||
#define IGNORE_PIN_PA25 1
|
||||
#define IGNORE_PIN_PA28 1
|
||||
#define IGNORE_PIN_PB01 1
|
||||
#define IGNORE_PIN_PB02 1
|
||||
#define IGNORE_PIN_PB03 1
|
||||
#define IGNORE_PIN_PB04 1
|
||||
#define IGNORE_PIN_PB05 1
|
||||
#define IGNORE_PIN_PB06 1
|
||||
#define IGNORE_PIN_PB07 1
|
||||
#define IGNORE_PIN_PB08 1
|
||||
#define IGNORE_PIN_PB09 1
|
||||
#define IGNORE_PIN_PB10 1
|
||||
#define IGNORE_PIN_PB11 1
|
||||
#define IGNORE_PIN_PB12 1
|
||||
#define IGNORE_PIN_PB13 1
|
||||
#define IGNORE_PIN_PB14 1
|
||||
#define IGNORE_PIN_PB15 1
|
||||
#define IGNORE_PIN_PB16 1
|
||||
#define IGNORE_PIN_PB17 1
|
||||
#define IGNORE_PIN_PB22 1
|
||||
#define IGNORE_PIN_PB23 1
|
||||
#define IGNORE_PIN_PB30 1
|
||||
#define IGNORE_PIN_PB31 1
|
||||
#define IGNORE_PIN_PB00 1
|
11
ports/atmel-samd/boards/catwan_usbstick/mpconfigboard.mk
Normal file
11
ports/atmel-samd/boards/catwan_usbstick/mpconfigboard.mk
Normal file
@ -0,0 +1,11 @@
|
||||
LD_FILE = boards/samd21x18-bootloader.ld
|
||||
USB_VID = 0xBAB2
|
||||
USB_PID = 0x1209
|
||||
USB_PRODUCT = "CatWAN USBStick"
|
||||
USB_MANUFACTURER = "Electronic Cats"
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
|
||||
CHIP_VARIANT = SAMD21E18A
|
||||
CHIP_FAMILY = samd21
|
19
ports/atmel-samd/boards/catwan_usbstick/pins.c
Normal file
19
ports/atmel-samd/boards/catwan_usbstick/pins.c
Normal file
@ -0,0 +1,19 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA30) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA31) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RFM9X_D0), MP_ROM_PTR(&pin_PA04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RFM9X_D1), MP_ROM_PTR(&pin_PA23) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RFM9X_D2), MP_ROM_PTR(&pin_PA27) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RFM9X_D5), MP_ROM_PTR(&pin_PA15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RFM9X_RST), MP_ROM_PTR(&pin_PA16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RFM9X_CS), MP_ROM_PTR(&pin_PA17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA19) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA22) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
@ -8,52 +8,24 @@
|
||||
#define SPI_FLASH_BAUDRATE (8000000)
|
||||
|
||||
// On-board flash
|
||||
#define SPI_FLASH_MOSI_PIN PIN_PA20
|
||||
#define SPI_FLASH_MISO_PIN PIN_PA16
|
||||
#define SPI_FLASH_SCK_PIN PIN_PA21
|
||||
#define SPI_FLASH_CS_PIN PIN_PB22
|
||||
|
||||
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA20D_SERCOM3_PAD2
|
||||
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA16D_SERCOM3_PAD0
|
||||
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA21D_SERCOM3_PAD3
|
||||
#define SPI_FLASH_SERCOM SERCOM3
|
||||
#define SPI_FLASH_SERCOM_INDEX 3
|
||||
#define SPI_FLASH_MOSI_PAD 2
|
||||
#define SPI_FLASH_MISO_PAD 0
|
||||
#define SPI_FLASH_SCK_PAD 3
|
||||
|
||||
// <o> Transmit Data Pinout
|
||||
// <0x0=>PAD[0,1]_DO_SCK
|
||||
// <0x1=>PAD[2,3]_DO_SCK
|
||||
// <0x2=>PAD[3,1]_DO_SCK
|
||||
// <0x3=>PAD[0,3]_DO_SCK
|
||||
#define SPI_FLASH_DOPO 1
|
||||
#define SPI_FLASH_DIPO 0 // same as MISO PAD
|
||||
#define SPI_FLASH_MOSI_PIN &pin_PA20
|
||||
#define SPI_FLASH_MISO_PIN &pin_PA16
|
||||
#define SPI_FLASH_SCK_PIN &pin_PA21
|
||||
#define SPI_FLASH_CS_PIN &pin_PB22
|
||||
|
||||
// These are pins not to reset.
|
||||
// PA24 and PA25 are USB.
|
||||
#define MICROPY_PORT_A (PORT_PA16 | PORT_PA20 | PORT_PA21 | PORT_PA24 | PORT_PA25)
|
||||
#define MICROPY_PORT_B (PORT_PB22)
|
||||
#define MICROPY_PORT_A (0)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#define SPEAKER_ENABLE_PIN (&pin_PA30)
|
||||
|
||||
#include "external_flash/devices.h"
|
||||
|
||||
// If you change this, then make sure to update the linker scripts as well to
|
||||
// make sure you don't overwrite code.
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#include "external_flash/devices.h"
|
||||
|
||||
#define EXTERNAL_FLASH_DEVICE_COUNT 2
|
||||
#define EXTERNAL_FLASH_DEVICES S25FL216K, \
|
||||
GD25Q16C
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
#define CALIBRATE_CRYSTALLESS 1
|
||||
|
||||
// Explanation of how a user got into safe mode.
|
||||
|
@ -5,6 +5,8 @@ USB_PRODUCT = "CircuitPlayground Express"
|
||||
USB_MANUFACTURER = "Adafruit Industries LLC"
|
||||
|
||||
SPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 2
|
||||
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
@ -17,3 +19,6 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Thermistor
|
||||
|
||||
#Adding per @danh to reduce memory usage and get the latest changes in
|
||||
CFLAGS_INLINE_LIMIT = 55
|
||||
|
@ -11,52 +11,24 @@
|
||||
#define SPI_FLASH_BAUDRATE (8000000)
|
||||
|
||||
// On-board flash
|
||||
#define SPI_FLASH_MOSI_PIN PIN_PA20
|
||||
#define SPI_FLASH_MISO_PIN PIN_PA16
|
||||
#define SPI_FLASH_SCK_PIN PIN_PA21
|
||||
#define SPI_FLASH_CS_PIN PIN_PB22
|
||||
|
||||
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA20D_SERCOM3_PAD2
|
||||
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA16D_SERCOM3_PAD0
|
||||
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA21D_SERCOM3_PAD3
|
||||
#define SPI_FLASH_SERCOM SERCOM3
|
||||
#define SPI_FLASH_SERCOM_INDEX 3
|
||||
#define SPI_FLASH_MOSI_PAD 2
|
||||
#define SPI_FLASH_MISO_PAD 0
|
||||
#define SPI_FLASH_SCK_PAD 3
|
||||
|
||||
// <o> Transmit Data Pinout
|
||||
// <0x0=>PAD[0,1]_DO_SCK
|
||||
// <0x1=>PAD[2,3]_DO_SCK
|
||||
// <0x2=>PAD[3,1]_DO_SCK
|
||||
// <0x3=>PAD[0,3]_DO_SCK
|
||||
#define SPI_FLASH_DOPO 1
|
||||
#define SPI_FLASH_DIPO 0 // same as MISO PAD
|
||||
#define SPI_FLASH_MOSI_PIN &pin_PA20
|
||||
#define SPI_FLASH_MISO_PIN &pin_PA16
|
||||
#define SPI_FLASH_SCK_PIN &pin_PA21
|
||||
#define SPI_FLASH_CS_PIN &pin_PB22
|
||||
|
||||
// These are pins not to reset.
|
||||
// PA24 and PA25 are USB.
|
||||
#define MICROPY_PORT_A (PORT_PA16 | PORT_PA20 | PORT_PA21 | PORT_PA24 | PORT_PA25)
|
||||
#define MICROPY_PORT_B (PORT_PB22)
|
||||
#define MICROPY_PORT_A (0)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#define SPEAKER_ENABLE_PIN (&pin_PA30)
|
||||
|
||||
#include "external_flash/devices.h"
|
||||
|
||||
// If you change this, then make sure to update the linker scripts as well to
|
||||
// make sure you don't overwrite code.
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#include "external_flash/devices.h"
|
||||
|
||||
#define EXTERNAL_FLASH_DEVICE_COUNT 2
|
||||
#define EXTERNAL_FLASH_DEVICES S25FL216K, \
|
||||
GD25Q16C
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
#define CALIBRATE_CRYSTALLESS 1
|
||||
|
||||
// Explanation of how a user got into safe mode.
|
||||
|
@ -5,6 +5,8 @@ USB_PRODUCT = "CircuitPlayground Express with Crickit libraries"
|
||||
USB_MANUFACTURER = "Adafruit Industries LLC"
|
||||
|
||||
SPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 2
|
||||
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
|
||||
# Turn off longints for Crickit build to make room for additional frozen libs.
|
||||
LONGINT_IMPL = NONE
|
||||
|
||||
|
@ -24,24 +24,16 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "boards/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "hal/include/hal_gpio.h"
|
||||
|
||||
#include "py/mperrno.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/microcontroller/__init__.h"
|
||||
#include "shared-bindings/storage/__init__.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
|
||||
extern volatile bool mp_msc_enabled;
|
||||
|
||||
void common_hal_storage_remount(const char *mount_path, bool readonly) {
|
||||
if (strcmp(mount_path, "/") != 0) {
|
||||
mp_raise_OSError(MP_EINVAL);
|
||||
}
|
||||
void board_init(void) {
|
||||
}
|
||||
|
||||
void common_hal_storage_erase_filesystem(void) {
|
||||
filesystem_init(false, true); // Force a re-format.
|
||||
common_hal_mcu_reset();
|
||||
// We won't actually get here, since we're resetting.
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
}
|
39
ports/atmel-samd/boards/cp32-m4/mpconfigboard.h
Normal file
39
ports/atmel-samd/boards/cp32-m4/mpconfigboard.h
Normal file
@ -0,0 +1,39 @@
|
||||
#define MICROPY_HW_BOARD_NAME "CP32-M4"
|
||||
#define MICROPY_HW_MCU_NAME "samd51g19"
|
||||
|
||||
#define MICROPY_HW_APA102_MOSI (&pin_PA17)
|
||||
#define MICROPY_HW_APA102_SCK (&pin_PA16)
|
||||
|
||||
|
||||
#define CIRCUITPY_MCU_FAMILY samd51
|
||||
|
||||
#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11| PORT_PA16| PORT_PA17)
|
||||
#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11)
|
||||
#define MICROPY_PORT_C (0)
|
||||
#define MICROPY_PORT_D (0)
|
||||
|
||||
#define AUTORESET_DELAY_MS 500
|
||||
|
||||
// If you change this, then make sure to update the linker scripts as well to
|
||||
// make sure you don't overwrite code
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 8192
|
||||
|
||||
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#include "external_flash/devices.h"
|
||||
|
||||
// these are the labeled pins (SDA, SCL, SCK, MOSI, MISO, etc)
|
||||
#define EXTERNAL_FLASH_DEVICE_COUNT 1
|
||||
#define EXTERNAL_FLASH_DEVICES W25Q128JV_PM
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PB09)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PB08)
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_PA22)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_PA23)
|
||||
#define DEFAULT_SPI_BUS_MISO (&pin_PA21)
|
||||
|
||||
#define DEFAULT_UART_BUS_RX (&pin_PA12)
|
||||
#define DEFAULT_UART_BUS_TX (&pin_PA13)
|
10
ports/atmel-samd/boards/cp32-m4/mpconfigboard.mk
Normal file
10
ports/atmel-samd/boards/cp32-m4/mpconfigboard.mk
Normal file
@ -0,0 +1,10 @@
|
||||
LD_FILE = boards/samd51x19-bootloader-external-flash.ld
|
||||
USB_VID = 0x239A
|
||||
USB_PID = 0x8021
|
||||
USB_PRODUCT = "CP32-M4"
|
||||
USB_MANUFACTURER = "Nadda-Reel Company LLC"
|
||||
|
||||
QSPI_FLASH_FILESYSTEM = 1
|
||||
|
||||
CHIP_VARIANT = SAMD51G19A
|
||||
CHIP_FAMILY = samd51
|
41
ports/atmel-samd/boards/cp32-m4/pins.c
Normal file
41
ports/atmel-samd/boards/cp32-m4/pins.c
Normal file
@ -0,0 +1,41 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
|
||||
// This mapping only includes functional names because pins broken
|
||||
// out on connectors are labeled with their MCU name available from
|
||||
// microcontroller.pin.
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SPEAKER_P), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PB08) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SW3_4), MP_ROM_PTR(&pin_PB09) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SW1_2), MP_ROM_PTR(&pin_PA04) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SPEAKER_N), MP_ROM_PTR(&pin_PA05) },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SW9), MP_ROM_PTR(&pin_PA06) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SW7), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_BACKLIGHT_PWM), MP_ROM_PTR(&pin_PA12) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_EXT_HDR3), MP_ROM_PTR(&pin_PA13) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SW5), MP_ROM_PTR(&pin_PA14) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_EXT_HDR4), MP_ROM_PTR(&pin_PA15) },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA16) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA17) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_STATUS_LED), MP_ROM_PTR(&pin_PA18) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SW6), MP_ROM_PTR(&pin_PA19) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_VSPI_CS0), MP_ROM_PTR(&pin_PA20) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_VSPI_MISO), MP_ROM_PTR(&pin_PA21) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_VSPI_SCK), MP_ROM_PTR(&pin_PA22) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_VSPI_MOSI), MP_ROM_PTR(&pin_PA23) },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_VSPI_CS1), MP_ROM_PTR(&pin_PB22) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_EXT_HDR5), MP_ROM_PTR(&pin_PB23) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_PA27) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SW8), MP_ROM_PTR(&pin_PB02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SW10), MP_ROM_PTR(&pin_PB03) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
@ -3,12 +3,10 @@
|
||||
#define MICROPY_HW_BOARD_NAME "Adafruit Feather M0 Adalogger"
|
||||
#define MICROPY_HW_MCU_NAME "samd21g18"
|
||||
|
||||
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
|
||||
#define MICROPY_PORT_A (0)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#include "internal_flash.h"
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
|
@ -28,6 +28,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_GREEN_LED), MP_ROM_PTR(&pin_PA06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
|
||||
|
@ -4,12 +4,10 @@
|
||||
#define MICROPY_HW_BOARD_NAME "Adafruit Feather M0 Basic"
|
||||
#define MICROPY_HW_MCU_NAME "samd21g18"
|
||||
|
||||
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
|
||||
#define MICROPY_PORT_A (0)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#include "internal_flash.h"
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
|
@ -22,6 +22,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
|
||||
|
@ -3,35 +3,16 @@
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_PA06)
|
||||
|
||||
// Clock rates are off: Salae reads 12MHz which is the limit even though we set it to the safer 8MHz.
|
||||
#define SPI_FLASH_BAUDRATE (8000000)
|
||||
|
||||
#define SPI_FLASH_MOSI_PIN PIN_PA08
|
||||
#define SPI_FLASH_MISO_PIN PIN_PA14
|
||||
#define SPI_FLASH_SCK_PIN PIN_PA09
|
||||
#define SPI_FLASH_CS_PIN PIN_PA13
|
||||
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA08D_SERCOM2_PAD0
|
||||
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA14C_SERCOM2_PAD2
|
||||
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA09D_SERCOM2_PAD1
|
||||
#define SPI_FLASH_SERCOM SERCOM2
|
||||
#define SPI_FLASH_SERCOM_INDEX 2
|
||||
#define SPI_FLASH_MOSI_PAD 0
|
||||
#define SPI_FLASH_MISO_PAD 2
|
||||
#define SPI_FLASH_SCK_PAD 1
|
||||
// <o> Transmit Data Pinout
|
||||
// <0x0=>PAD[0,1]_DO_SCK
|
||||
// <0x1=>PAD[2,3]_DO_SCK
|
||||
// <0x2=>PAD[3,1]_DO_SCK
|
||||
// <0x3=>PAD[0,3]_DO_SCK
|
||||
#define SPI_FLASH_DOPO 0
|
||||
#define SPI_FLASH_DIPO 2 // same as MISO pad
|
||||
#define SPI_FLASH_MOSI_PIN &pin_PA08
|
||||
#define SPI_FLASH_MISO_PIN &pin_PA14
|
||||
#define SPI_FLASH_SCK_PIN &pin_PA09
|
||||
#define SPI_FLASH_CS_PIN &pin_PA13
|
||||
|
||||
// These are pins not to reset.
|
||||
#define MICROPY_PORT_A (PORT_PA06 | PORT_PA08 | PORT_PA09 | PORT_PA13 | PORT_PA14 | PORT_PA24 | PORT_PA25)
|
||||
#define MICROPY_PORT_A (PORT_PA06)
|
||||
#define MICROPY_PORT_B ( 0 )
|
||||
#define MICROPY_PORT_C ( 0 )
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
// If you change this, then make sure to update the linker scripts as well to
|
||||
// make sure you don't overwrite code.
|
||||
@ -39,14 +20,6 @@
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#include "external_flash/devices.h"
|
||||
|
||||
#define EXTERNAL_FLASH_DEVICE_COUNT 2
|
||||
#define EXTERNAL_FLASH_DEVICES S25FL216K, \
|
||||
GD25Q16C
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
#define BOARD_HAS_CRYSTAL 1
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
|
||||
|
@ -5,7 +5,12 @@ USB_PRODUCT = "Feather M0 Express"
|
||||
USB_MANUFACTURER = "Adafruit Industries LLC"
|
||||
|
||||
SPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 2
|
||||
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
||||
|
||||
MICROPY_PY_NETWORK = 1
|
||||
MICROPY_PY_WIZNET5K = 5500
|
||||
|
@ -22,6 +22,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
|
||||
|
@ -3,50 +3,22 @@
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_PA06)
|
||||
|
||||
// Clock rates are off: Salae reads 12MHz which is the limit even though we set it to the safer 8MHz.
|
||||
#define SPI_FLASH_BAUDRATE (8000000)
|
||||
|
||||
#define SPI_FLASH_MOSI_PIN PIN_PA08
|
||||
#define SPI_FLASH_MISO_PIN PIN_PA14
|
||||
#define SPI_FLASH_SCK_PIN PIN_PA09
|
||||
#define SPI_FLASH_CS_PIN PIN_PA13
|
||||
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA08D_SERCOM2_PAD0
|
||||
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA14C_SERCOM2_PAD2
|
||||
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA09D_SERCOM2_PAD1
|
||||
#define SPI_FLASH_SERCOM SERCOM2
|
||||
#define SPI_FLASH_SERCOM_INDEX 2
|
||||
#define SPI_FLASH_MOSI_PAD 0
|
||||
#define SPI_FLASH_MISO_PAD 2
|
||||
#define SPI_FLASH_SCK_PAD 1
|
||||
// <o> Transmit Data Pinout
|
||||
// <0x0=>PAD[0,1]_DO_SCK
|
||||
// <0x1=>PAD[2,3]_DO_SCK
|
||||
// <0x2=>PAD[3,1]_DO_SCK
|
||||
// <0x3=>PAD[0,3]_DO_SCK
|
||||
#define SPI_FLASH_DOPO 0
|
||||
#define SPI_FLASH_DIPO 2 // same as MISO pad
|
||||
#define SPI_FLASH_MOSI_PIN &pin_PA08
|
||||
#define SPI_FLASH_MISO_PIN &pin_PA14
|
||||
#define SPI_FLASH_SCK_PIN &pin_PA09
|
||||
#define SPI_FLASH_CS_PIN &pin_PA13
|
||||
|
||||
// These are pins not to reset.
|
||||
#define MICROPY_PORT_A (PORT_PA06 | PORT_PA08 | PORT_PA09 | PORT_PA13 | PORT_PA14 | PORT_PA24 | PORT_PA25)
|
||||
#define MICROPY_PORT_A (PORT_PA06)
|
||||
#define MICROPY_PORT_B ( 0 )
|
||||
#define MICROPY_PORT_C ( 0 )
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
// If you change this, then make sure to update the linker scripts as well to
|
||||
// make sure you don't overwrite code.
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#include "external_flash/devices.h"
|
||||
|
||||
#define EXTERNAL_FLASH_DEVICE_COUNT 2
|
||||
#define EXTERNAL_FLASH_DEVICES S25FL216K, \
|
||||
GD25Q16C
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
#define BOARD_HAS_CRYSTAL 1
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
|
||||
|
@ -5,6 +5,8 @@ USB_PRODUCT = "Feather M0 Express"
|
||||
USB_MANUFACTURER = "Adafruit Industries LLC"
|
||||
|
||||
SPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 2
|
||||
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
|
@ -22,6 +22,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
|
||||
|
@ -4,12 +4,10 @@
|
||||
#define MICROPY_HW_BOARD_NAME "Adafruit Feather M0 RFM69"
|
||||
#define MICROPY_HW_MCU_NAME "samd21g18"
|
||||
|
||||
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
|
||||
#define MICROPY_PORT_A (0)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#include "internal_flash.h"
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
|
@ -22,6 +22,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
|
||||
|
@ -4,12 +4,10 @@
|
||||
#define MICROPY_HW_BOARD_NAME "Adafruit Feather M0 RFM9x"
|
||||
#define MICROPY_HW_MCU_NAME "samd21g18"
|
||||
|
||||
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
|
||||
#define MICROPY_PORT_A (0)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#include "internal_flash.h"
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
|
@ -22,6 +22,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
|
||||
|
@ -5,49 +5,22 @@
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_PA06)
|
||||
|
||||
// Clock rates are off: Salae reads 12MHz which is the limit even though we set it to the safer 8MHz.
|
||||
#define SPI_FLASH_BAUDRATE (8000000)
|
||||
|
||||
#define SPI_FLASH_MOSI_PIN PIN_PA08
|
||||
#define SPI_FLASH_MISO_PIN PIN_PA14
|
||||
#define SPI_FLASH_SCK_PIN PIN_PA09
|
||||
#define SPI_FLASH_CS_PIN PIN_PA13
|
||||
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA08D_SERCOM2_PAD0
|
||||
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA14C_SERCOM2_PAD2
|
||||
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA09D_SERCOM2_PAD1
|
||||
#define SPI_FLASH_SERCOM SERCOM2
|
||||
#define SPI_FLASH_SERCOM_INDEX 2
|
||||
#define SPI_FLASH_MOSI_PAD 0
|
||||
#define SPI_FLASH_MISO_PAD 2
|
||||
#define SPI_FLASH_SCK_PAD 1
|
||||
// <o> Transmit Data Pinout
|
||||
// <0x0=>PAD[0,1]_DO_SCK
|
||||
// <0x1=>PAD[2,3]_DO_SCK
|
||||
// <0x2=>PAD[3,1]_DO_SCK
|
||||
// <0x3=>PAD[0,3]_DO_SCK
|
||||
#define SPI_FLASH_DOPO 0
|
||||
#define SPI_FLASH_DIPO 2 // same as MISO pad
|
||||
#define SPI_FLASH_MOSI_PIN &pin_PA08
|
||||
#define SPI_FLASH_MISO_PIN &pin_PA14
|
||||
#define SPI_FLASH_SCK_PIN &pin_PA09
|
||||
#define SPI_FLASH_CS_PIN &pin_PA13
|
||||
|
||||
// These are pins not to reset.
|
||||
#define MICROPY_PORT_A (PORT_PA06 | PORT_PA08 | PORT_PA09 | PORT_PA13 | PORT_PA14 | PORT_PA24 | PORT_PA25)
|
||||
#define MICROPY_PORT_A (PORT_PA06)
|
||||
#define MICROPY_PORT_B ( 0 )
|
||||
#define MICROPY_PORT_C ( 0 )
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
// If you change this, then make sure to update the linker scripts as well to
|
||||
// make sure you don't overwrite code.
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#include "external_flash/devices.h"
|
||||
|
||||
#define EXTERNAL_FLASH_DEVICE_COUNT 1
|
||||
#define EXTERNAL_FLASH_DEVICES S25FL064L
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
|
||||
|
||||
|
@ -5,6 +5,8 @@ USB_PRODUCT = "Feather M0 Supersized"
|
||||
USB_MANUFACTURER = "Dave Astels"
|
||||
|
||||
SPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 1
|
||||
EXTERNAL_FLASH_DEVICES = "S25FL064L"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
|
@ -22,6 +22,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
|
||||
|
@ -23,15 +23,8 @@
|
||||
|
||||
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#include "external_flash/devices.h"
|
||||
|
||||
#define EXTERNAL_FLASH_DEVICE_COUNT 1
|
||||
#define EXTERNAL_FLASH_DEVICES GD25Q16C
|
||||
|
||||
#define EXTERNAL_FLASH_QSPI_DUAL
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
#define BOARD_HAS_CRYSTAL 1
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA13)
|
||||
|
@ -5,7 +5,13 @@ USB_PRODUCT = "Feather M4 Express"
|
||||
USB_MANUFACTURER = "Adafruit Industries LLC"
|
||||
|
||||
QSPI_FLASH_FILESYSTEM = 1
|
||||
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 1
|
||||
EXTERNAL_FLASH_DEVICES = GD25Q16C
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CHIP_VARIANT = SAMD51J19A
|
||||
CHIP_FAMILY = samd51
|
||||
|
||||
MICROPY_PY_NETWORK = 1
|
||||
MICROPY_PY_WIZNET5K = 5500
|
||||
|
@ -28,6 +28,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA23) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PB01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PB01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||
|
@ -3,50 +3,22 @@
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_PA22)
|
||||
|
||||
// Clock rates are off: Salae reads 12MHz which is the limit even though we set it to the safer 8MHz.
|
||||
#define SPI_FLASH_BAUDRATE (8000000)
|
||||
|
||||
#define SPI_FLASH_MOSI_PIN PIN_PA31
|
||||
#define SPI_FLASH_MISO_PIN PIN_PA30
|
||||
#define SPI_FLASH_SCK_PIN PIN_PA17
|
||||
#define SPI_FLASH_CS_PIN PIN_PA28
|
||||
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA31D_SERCOM1_PAD3
|
||||
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA30D_SERCOM1_PAD2
|
||||
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA17C_SERCOM1_PAD1
|
||||
#define SPI_FLASH_SERCOM SERCOM1
|
||||
#define SPI_FLASH_SERCOM_INDEX 1
|
||||
#define SPI_FLASH_MOSI_PAD 3
|
||||
#define SPI_FLASH_MISO_PAD 2
|
||||
#define SPI_FLASH_SCK_PAD 1
|
||||
// <o> Transmit Data Pinout
|
||||
// <0x0=>PAD[0,1]_DO_SCK
|
||||
// <0x1=>PAD[2,3]_DO_SCK
|
||||
// <0x2=>PAD[3,1]_DO_SCK
|
||||
// <0x3=>PAD[0,3]_DO_SCK
|
||||
#define SPI_FLASH_DOPO 2
|
||||
#define SPI_FLASH_DIPO 2 // same as MISO pad
|
||||
#define SPI_FLASH_MOSI_PIN &pin_PA31
|
||||
#define SPI_FLASH_MISO_PIN &pin_PA30
|
||||
#define SPI_FLASH_SCK_PIN &pin_PA17
|
||||
#define SPI_FLASH_CS_PIN &pin_PA28
|
||||
|
||||
// These are pins not to reset.
|
||||
#define MICROPY_PORT_A (PORT_PA17 | PORT_PA22 | PORT_PA24 | PORT_PA25 | PORT_PA28 | PORT_PA30 | PORT_PA31)
|
||||
#define MICROPY_PORT_A (PORT_PA22)
|
||||
#define MICROPY_PORT_B ( 0 )
|
||||
#define MICROPY_PORT_C ( 0 )
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
// If you change this, then make sure to update the linker scripts as well to
|
||||
// make sure you don't overwrite code.
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#include "external_flash/devices.h"
|
||||
|
||||
#define EXTERNAL_FLASH_DEVICE_COUNT 2
|
||||
#define EXTERNAL_FLASH_DEVICES S25FL216K, \
|
||||
GD25Q16C
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
#define BOARD_HAS_CRYSTAL 1
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA13)
|
||||
|
@ -5,6 +5,8 @@ USB_PRODUCT = "Feather RadioFruit Zigbee"
|
||||
USB_MANUFACTURER = "Adafruit Industries LLC"
|
||||
|
||||
SPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 2
|
||||
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CHIP_VARIANT = SAMR21G18A
|
||||
|
@ -18,8 +18,6 @@
|
||||
#define DEFAULT_UART_BUS_RX (&pin_PA05)
|
||||
#define DEFAULT_UART_BUS_TX (&pin_PA04)
|
||||
|
||||
#include "internal_flash.h"
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
|
||||
#define IGNORE_PIN_PA03 1
|
||||
|
@ -29,13 +29,6 @@
|
||||
#include "hal/include/hal_gpio.h"
|
||||
|
||||
void board_init(void) {
|
||||
gpio_set_pin_function(MICROPY_HW_LED_TX, GPIO_PIN_FUNCTION_OFF);
|
||||
gpio_set_pin_direction(MICROPY_HW_LED_TX, GPIO_DIRECTION_OUT);
|
||||
gpio_set_pin_level(MICROPY_HW_LED_TX, true);
|
||||
|
||||
gpio_set_pin_function(MICROPY_HW_LED_RX, GPIO_PIN_FUNCTION_OFF);
|
||||
gpio_set_pin_direction(MICROPY_HW_LED_RX, GPIO_DIRECTION_OUT);
|
||||
gpio_set_pin_level(MICROPY_HW_LED_RX, true);
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -5,8 +5,8 @@
|
||||
|
||||
// This is for Rev A which is green
|
||||
|
||||
#define MICROPY_HW_LED_TX PIN_PC30
|
||||
#define MICROPY_HW_LED_RX PIN_PC31
|
||||
#define MICROPY_HW_LED_TX &(pin_PC30)
|
||||
#define MICROPY_HW_LED_RX &(pin_PC31)
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_PC24)
|
||||
|
||||
@ -27,13 +27,6 @@
|
||||
|
||||
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#include "external_flash/devices.h"
|
||||
|
||||
#define EXTERNAL_FLASH_DEVICE_COUNT 1
|
||||
#define EXTERNAL_FLASH_DEVICES GD25Q64C
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
#define BOARD_HAS_CRYSTAL 1
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PB21)
|
||||
|
@ -5,6 +5,9 @@ USB_PRODUCT = "Grand Central M4 Express"
|
||||
USB_MANUFACTURER = "Adafruit Industries LLC"
|
||||
|
||||
QSPI_FLASH_FILESYSTEM = 1
|
||||
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 1
|
||||
EXTERNAL_FLASH_DEVICES = "GD25Q64C"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CHIP_VARIANT = SAMD51P20A
|
||||
|
@ -3,51 +3,24 @@
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_PA12)
|
||||
|
||||
// Clock rates are off: Saleae reads 12MHz which is the limit even though we set it to the safer 8MHz.
|
||||
#define SPI_FLASH_BAUDRATE (8000000)
|
||||
|
||||
#define SPI_FLASH_MOSI_PIN PIN_PB10
|
||||
#define SPI_FLASH_MISO_PIN PIN_PA13
|
||||
#define SPI_FLASH_SCK_PIN PIN_PB11
|
||||
#define SPI_FLASH_CS_PIN PIN_PA07
|
||||
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PB10D_SERCOM4_PAD2
|
||||
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA13D_SERCOM4_PAD1
|
||||
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PB11D_SERCOM4_PAD3
|
||||
#define SPI_FLASH_SERCOM SERCOM4
|
||||
#define SPI_FLASH_SERCOM_INDEX 4
|
||||
#define SPI_FLASH_MOSI_PAD 2
|
||||
#define SPI_FLASH_MISO_PAD 1
|
||||
#define SPI_FLASH_SCK_PAD 3
|
||||
// <o> Transmit Data Pinout
|
||||
// <0x0=>PAD[0,1]_DO_SCK
|
||||
// <0x1=>PAD[2,3]_DO_SCK
|
||||
// <0x2=>PAD[3,1]_DO_SCK
|
||||
// <0x3=>PAD[0,3]_DO_SCK
|
||||
#define SPI_FLASH_DOPO 0x1
|
||||
#define SPI_FLASH_DIPO 1 // same as MISO pad
|
||||
#define SPI_FLASH_MOSI_PIN &pin_PB10
|
||||
#define SPI_FLASH_MISO_PIN &pin_PA13
|
||||
#define SPI_FLASH_SCK_PIN &pin_PB11
|
||||
#define SPI_FLASH_CS_PIN &pin_PA07
|
||||
|
||||
// These are pins not to reset.
|
||||
#define MICROPY_PORT_A ( PORT_PA01 | PORT_PA07 | PORT_PA12 | PORT_PA13 | PORT_PA24 | PORT_PA25 | PORT_PA27 | PORT_PA28)
|
||||
#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11 | PORT_PB22 | PORT_PB23 )
|
||||
// NeoPixel and for the display: Reset, Command or data, and Chip select
|
||||
#define MICROPY_PORT_A ( PORT_PA01 | PORT_PA12 | PORT_PA27 | PORT_PA28)
|
||||
// Data and Clock for the display
|
||||
#define MICROPY_PORT_B ( PORT_PB22 | PORT_PB23 )
|
||||
#define MICROPY_PORT_C ( 0 )
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
// If you change this, then make sure to update the linker scripts as well to
|
||||
// make sure you don't overwrite code.
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#include "external_flash/devices.h"
|
||||
|
||||
#define EXTERNAL_FLASH_DEVICE_COUNT 2
|
||||
|
||||
#define EXTERNAL_FLASH_DEVICES W25Q64JV_IQ, \
|
||||
GD25Q64C
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA17)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA16)
|
||||
|
||||
|
@ -5,6 +5,8 @@ USB_PRODUCT = "HalloWing M0 Express"
|
||||
USB_MANUFACTURER = "Adafruit Industries LLC"
|
||||
|
||||
SPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 2
|
||||
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
|
@ -5,32 +5,14 @@
|
||||
#define MICROPY_HW_APA102_MOSI (&pin_PA01)
|
||||
#define MICROPY_HW_APA102_SCK (&pin_PA00)
|
||||
|
||||
// Saleae reads 12mhz which is the limit even though we set it to the safer 8mhz.
|
||||
#define SPI_FLASH_BAUDRATE (8000000)
|
||||
|
||||
#define SPI_FLASH_MOSI_PIN PIN_PB22
|
||||
#define SPI_FLASH_MISO_PIN PIN_PB03
|
||||
#define SPI_FLASH_SCK_PIN PIN_PB23
|
||||
#define SPI_FLASH_CS_PIN PIN_PA27
|
||||
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PB22D_SERCOM5_PAD2
|
||||
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PB03D_SERCOM5_PAD1
|
||||
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PB23D_SERCOM5_PAD3
|
||||
#define SPI_FLASH_SERCOM SERCOM5
|
||||
#define SPI_FLASH_SERCOM_INDEX 5
|
||||
#define SPI_FLASH_MOSI_PAD 2
|
||||
#define SPI_FLASH_MISO_PAD 1
|
||||
#define SPI_FLASH_SCK_PAD 3
|
||||
// <o> Transmit Data Pinout
|
||||
// <0x0=>PAD[0,1]_DO_SCK
|
||||
// <0x1=>PAD[2,3]_DO_SCK
|
||||
// <0x2=>PAD[3,1]_DO_SCK
|
||||
// <0x3=>PAD[0,3]_DO_SCK
|
||||
#define SPI_FLASH_DOPO 1
|
||||
#define SPI_FLASH_DIPO 1 // same as MISO pad
|
||||
#define SPI_FLASH_MOSI_PIN &pin_PB22
|
||||
#define SPI_FLASH_MISO_PIN &pin_PB03
|
||||
#define SPI_FLASH_SCK_PIN &pin_PB23
|
||||
#define SPI_FLASH_CS_PIN &pin_PA27
|
||||
|
||||
// These are pins not to reset.
|
||||
#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA27 | PORT_PA24 | PORT_PA25)
|
||||
#define MICROPY_PORT_B (PORT_PB22 | PORT_PB23 | PORT_PB03 )
|
||||
#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
// If you change this, then make sure to update the linker scripts as well to
|
||||
@ -39,14 +21,6 @@
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#include "external_flash/devices.h"
|
||||
|
||||
#define EXTERNAL_FLASH_DEVICE_COUNT 2
|
||||
#define EXTERNAL_FLASH_DEVICES W25Q16FW, \
|
||||
GD25Q16C
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
|
||||
|
||||
|
@ -5,6 +5,8 @@ USB_PRODUCT = "ItsyBitsy M0 Express"
|
||||
USB_MANUFACTURER = "Adafruit Industries LLC"
|
||||
|
||||
SPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 2
|
||||
EXTERNAL_FLASH_DEVICES = "W25Q16FW, GD25Q16C"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
|
@ -25,13 +25,6 @@
|
||||
|
||||
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#include "external_flash/devices.h"
|
||||
|
||||
#define EXTERNAL_FLASH_DEVICE_COUNT 1
|
||||
#define EXTERNAL_FLASH_DEVICES GD25Q16C
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA13)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA12)
|
||||
|
||||
|
@ -5,6 +5,8 @@ USB_PRODUCT = "ItsyBitsy M4 Express"
|
||||
USB_MANUFACTURER = "Adafruit Industries LLC"
|
||||
|
||||
QSPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 1
|
||||
EXTERNAL_FLASH_DEVICES = GD25Q16C
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CHIP_VARIANT = SAMD51G19A
|
||||
|
38
ports/atmel-samd/boards/meowmeow/board.c
Normal file
38
ports/atmel-samd/boards/meowmeow/board.c
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Andrés Sabas for Electronic Cats
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "boards/board.h"
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
}
|
32
ports/atmel-samd/boards/meowmeow/mpconfigboard.h
Normal file
32
ports/atmel-samd/boards/meowmeow/mpconfigboard.h
Normal file
@ -0,0 +1,32 @@
|
||||
#define MICROPY_HW_BOARD_NAME "Meow Meow"
|
||||
#define MICROPY_HW_MCU_NAME "samd21g18"
|
||||
|
||||
// These are pins not to reset.
|
||||
#define MICROPY_PORT_A (0)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
// If you change this, then make sure to update the linker scripts as well to
|
||||
// make sure you don't overwrite code.
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
|
||||
#define CALIBRATE_CRYSTALLESS 1
|
||||
|
||||
// Explanation of how a user got into safe mode.
|
||||
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up"
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA01)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA00)
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_PA15)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_PA14)
|
||||
#define DEFAULT_SPI_BUS_MISO (&pin_PA12)
|
||||
|
||||
#define DEFAULT_UART_BUS_RX (&pin_PA11)
|
||||
#define DEFAULT_UART_BUS_TX (&pin_PA10)
|
||||
|
||||
// USB is always used internally so skip the pin objects for it.
|
||||
#define IGNORE_PIN_PA24 1
|
||||
#define IGNORE_PIN_PA25 1
|
11
ports/atmel-samd/boards/meowmeow/mpconfigboard.mk
Normal file
11
ports/atmel-samd/boards/meowmeow/mpconfigboard.mk
Normal file
@ -0,0 +1,11 @@
|
||||
LD_FILE = boards/samd21x18-bootloader.ld
|
||||
USB_VID = 0xBAB1
|
||||
USB_PID = 0x1209
|
||||
USB_PRODUCT = "Meow Meow"
|
||||
USB_MANUFACTURER = "Electronic Cats"
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
43
ports/atmel-samd/boards/meowmeow/pins.c
Normal file
43
ports/atmel-samd/boards/meowmeow/pins.c
Normal file
@ -0,0 +1,43 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PB03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PB08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PB09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PA11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_PA09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PB02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PB03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB22) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA30) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA31) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB23) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
@ -1,37 +1,23 @@
|
||||
#define MICROPY_HW_BOARD_NAME "Adafruit Metro M0 Express"
|
||||
#define MICROPY_HW_MCU_NAME "samd21g18"
|
||||
|
||||
#define MICROPY_HW_LED_TX PIN_PA27
|
||||
//#define MICROPY_HW_LED_RX PIN_PA31
|
||||
#define MICROPY_HW_LED_TX &pin_PA27
|
||||
// Comment this out if you have trouble connecting over SWD. It's one of the SWD pins.
|
||||
#define MICROPY_HW_LED_RX &pin_PA31
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_PA30)
|
||||
|
||||
// Clock rates are off: Salae reads 12MHz which is the limit even though we set it to the safer 8MHz.
|
||||
#define SPI_FLASH_BAUDRATE (8000000)
|
||||
|
||||
#define SPI_FLASH_MOSI_PIN PIN_PB22
|
||||
#define SPI_FLASH_MISO_PIN PIN_PB03
|
||||
#define SPI_FLASH_SCK_PIN PIN_PB23
|
||||
#define SPI_FLASH_CS_PIN PIN_PA13
|
||||
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PB22D_SERCOM5_PAD2
|
||||
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PB03D_SERCOM5_PAD1
|
||||
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PB23D_SERCOM5_PAD3
|
||||
#define SPI_FLASH_SERCOM SERCOM5
|
||||
#define SPI_FLASH_SERCOM_INDEX 5
|
||||
#define SPI_FLASH_MOSI_PAD 2
|
||||
#define SPI_FLASH_MISO_PAD 1
|
||||
#define SPI_FLASH_SCK_PAD 3
|
||||
// <o> Transmit Data Pinout
|
||||
// <0x0=>PAD[0,1]_DO_SCK
|
||||
// <0x1=>PAD[2,3]_DO_SCK
|
||||
// <0x2=>PAD[3,1]_DO_SCK
|
||||
// <0x3=>PAD[0,3]_DO_SCK
|
||||
#define SPI_FLASH_DOPO 1
|
||||
#define SPI_FLASH_DIPO 1 // same as MISO pad
|
||||
#define SPI_FLASH_MOSI_PIN &pin_PB22
|
||||
#define SPI_FLASH_MISO_PIN &pin_PB03
|
||||
#define SPI_FLASH_SCK_PIN &pin_PB23
|
||||
#define SPI_FLASH_CS_PIN &pin_PA13
|
||||
|
||||
// These are pins not to reset.
|
||||
#define MICROPY_PORT_A (PORT_PA13 |PORT_PA24 | PORT_PA25 | PORT_PA27 | PORT_PA30 | PORT_PA31)
|
||||
#define MICROPY_PORT_B (PORT_PB03 | PORT_PB22 | PORT_PB23)
|
||||
#define MICROPY_PORT_A (0)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
// If you change this, then make sure to update the linker scripts as well to
|
||||
@ -40,14 +26,6 @@
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#include "external_flash/devices.h"
|
||||
|
||||
#define EXTERNAL_FLASH_DEVICE_COUNT 2
|
||||
#define EXTERNAL_FLASH_DEVICES S25FL216K, \
|
||||
GD25Q16C
|
||||
|
||||
#include "external_flash/external_flash.h"
|
||||
|
||||
#define BOARD_HAS_CRYSTAL 1
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user